Giter Club home page Giter Club logo

mercure's Introduction

mercure


https://github.com/dunglas/mercure

const url = new URL('https://example.com/hub');
url.searchParams.append('topic', 'https://example.com/books/{id}');
url.searchParams.append('topic', 'https://example.com/users/dunglas');

const eventSource = new EventSource(url);
eventSource.onmessage = e => console.log(e);

fetch('https://example.com/book/1')
  .then(response => {
    const hubUrl = response.headers.get('Link').match(/<([^>]+)>;\s+rel=(?:mercure|"[^"]*mercure[^"]*")/)[1];
  });
const https = require('https');
const querystring = require('querystring');

const postData = querystring.stringify({
  'topic': 'https://example.com/books/1',
  'data': JSON.stringify({ foo: 'updated value' }),
});

const req = https.request({
  hostname: 'example.com',
  port: '443',
  path: '/hub',
  method: 'POST',
  headers: {
    Authorization: 'Bearer <valid-jwt-token>',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Content-Length': Buffer.byteLength(postData),
  }
},  );
req.write(postData);
req.end();
JWT_KEY='myJWTKey' ADDR=':3000' DEMO=1 ALLOW_ANONYMOUS=1 CORS_ALLOWED_ORIGINS=* PUBLISH_ALLOWED_ORIGINS='http://localhost:3000' ./mercure
JWT_KEY='myJWTKey' ACME_HOSTS='example.com' ./mercure

docker run \
  -e JWT_KEY='myJWTKey' -e DEMO=1 -e ALLOW_ANONYMOUS=1 -e PUBLISH_ALLOWED_ORIGINS='http://localhost' \
  -p 80:80 \
  dunglas/mercure
  
docker run \
  -e JWT_KEY='myJWTKey' -e ACME_HOSTS='example.com' \
  -p 80:80 -p 443:443 \
  dunglas/mercure

helm install stable/mercure
server {
  listen 80 ssl http2;
  listen [::]:80 ssl http2;
  
  ssl_certificate /path/to/ssl/cert.crt;
  ssl_certificate_key /path/to/ssl/cert.key;
  
  location / {
    proxy_pass http://url-of-your-mercure-hub;
    proxy_read_timeout 24h;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
  }
}

mercure's People

Contributors

takagotch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.