Created
September 2, 2020 18:19
-
-
Save maxinspace/d28421b61c343036c51ff6bc5a10cd54 to your computer and use it in GitHub Desktop.
Centrifugo JS example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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