Skip to content

Instantly share code, notes, and snippets.

@maxinspace
Created September 2, 2020 18:19
Show Gist options
  • Save maxinspace/d28421b61c343036c51ff6bc5a10cd54 to your computer and use it in GitHub Desktop.
Save maxinspace/d28421b61c343036c51ff6bc5a10cd54 to your computer and use it in GitHub Desktop.
Centrifugo JS example
var centrifuge = new Centrifuge('wss://mesh.rocketbank.sexy/connection/websocket', {
refreshEndpoint: "https://vault34.rocketbank.ru/api/admins/push_authorizations",
refreshHeaders: { 'X-API-VERSION': 'v2', 'Authorization': '<<TOKEN>>' },
subscribeEndpoint: 'https://vault34.rocketbank,ru/api/admins/push_authorizations/subscribe',
subscribeHeaders: { 'X-API-VERSION': 'v2', 'Authorization': '<<TOKEN>>' }
});
authToken = <<POST https://vault34.rocketbank.ru/api/admins/push_authorizations -> token >>
centrifuge.setToken(authToken);
centrifuge.subscribe("presence-tickets", function(message) { });
centrifuge.subscribe("$presence-tickets-admin-1251", function(message) { console.log(message) });
centrifuge.connect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment