Reworking to 1 single instance
Added auxiliary utility for cleaning old messages from DOM
Added unsubscribe from channel, mechanism for resubscribing to channel
Added channel system
Added ability to process custom events
Added ability to extend events that are sent via websocket
Now the connection token is generated on all pages, if you want to override you can set your parameters in the constructor for the token, host and path.
Added a check for subscribing to an existing channel.
Update centrifugo js
Updated js completely to work with centrifuge. Now this core as originally planned, no elements are processed. Only connections, event handling and channel subscriptions
js with a centrifuge and a connection to it now goes on all pages, this is done specifically to allow other add-ons to interact with it and use elements on other pages
To switch to version 6, use the migration service:
Example of a new config:
Code:{ "client": { "token": { "hmac_secret_key": "YOUR_DATA" }, "allowed_origins": [ "http://localhost", ] }, "channel": { "namespaces": [ { "name": "public", "allow_subscribe_for_client": true }, { "name": "dm", "allow_user_limited_channels": true } ] }, "admin": { "enabled": true, "password": "YOUR_DATA", "secret": "YOUR_DATA" }, "http_api": { "key": "YOUR_DATA" } }
Fixed a bug in 2.3 where messages were not added to a thread when there were no pages (pagination).
Minimum version of Core Lib 2.2.4
The server must use centrifuge version 4
!!! To switch to v4, use the built-in config migration tool:
When using the addition of live conversations or threads, it does not go to the last message, but remains in the same position. On large forums, this causes discomfort.![]()
Migrating to v4 | Centrifugo
Centrifugo v4 development was concentrated around two main things:centrifugal.dev
Added new triggers and their handling, now you can inline your code while connecting to a socket and when you connected to it.
In case of successful connection Client states will transition like this:
disconnected (initial)
->connecting (on('connecting') called)
->connected (on('connected') called)
.
In case of already connected Client temporary lost a connection with a server and then successfully reconnected:
connected
->connecting (on('connecting') called)
->connected (on('connected') called)
.
In case of already connected Client temporary lost a connection with a server, but got a terminal error upon reconnection:
connected
->connecting (on('connecting') called)
->disconnected (on('disconnected') called)
.
In case of already connected Client came across terminal condition (for example, if during a connection token refresh application found that user has no permission to connect anymore):
connected
->disconnected (on('disconnected') called)
.
Both connecting and disconnected events have numeric code and human-readable string reason in their context, so you can look at them and find the exact reason why the Client went to the connecting state or to the disconnected state.
This diagram demonstrates possible Client state transitions:
![]()
The following events will be available soon:
subscribed
- Called when subscribed to a server-side channel upon Client moving to connected state or during connection lifetime if server sends Subscribe push message.
subscribing
- Called when existing connection lost (Client reconnects) or Client explicitly disconnected. Client continue keeping server-side subscription registry with stream position information where applicable.
unsubscribed
- Called when server sent unsubscribe push or server-side subscription
publication
This diagram demonstrates possible Subscription state transitions:
![]()
Add cli command: mcgo-centrifugo:info
Generate jwt token for subcription
We pass the token that we generated. Also, if an empty string is passed and you do not need to generate tokens every time for guests, specify in the setting
If you are using our add-ons, then you must remove these options from the configuration. Because they are no longer relevant.JSON:"anonymous": true "client_anonymous": true
If you are using the live threads add-on (https://xenforo.com/community/resources/mmo-live-threads.8777/)
You must add a namespace. Example configuration with live threads:
You can find information about namespaces here:JSON:{ "token_hmac_secret_key": "", "admin_password": "", "admin_secret": "", "api_key": "", "allowed_origins": [ "your_hosting", ], "namespaces": [ { "name": "public" } ] }
![]()
Channels | Centrifugo
Channel is a route for publications. Clients can be subscribed to a channel to receive real-time messages published to a channel – new publications and join/leave events (if enabled for a channel namespace). A channel subscriber can also ask for a channel presence or channel history information...centrifugal.dev
We use essential cookies to make this site work, and optional cookies to enhance your experience.