Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Dmytro
    @dmytrobieliaiev
    Thanks, fixed, working.
    Alexander Emelin
    @FZambia
    :thumbsup:
    Anish Menon
    @anishmenon
    disconnected: connection closed true
    [1] Status connecting -> disconnected
    [1] reconnect after 13811 milliseconds
    [1] start connecting
    [1] Status disconnected -> connecting
    [1] transport level error ErrorEvent {
    [1] [Symbol(kTarget)]: WebSocket {
    [1] _events: [Object: null prototype] {
    [1] open: [Function],
    [1] error: [Function],
    [1] close: [Function],
    [1] message: [Function]
    [1] },
    [1] _eventsCount: 4,
    [1] _maxListeners: undefined,
    [1] _binaryType: 'nodebuffer',
    [1] _closeCode: 1006,
    [1] _closeFrameReceived: false,
    [1] _closeFrameSent: false,
    [1] _closeMessage: <Buffer >,
    [1] _closeTimer: null,
    [1] _extensions: {},
    [1] _protocol: '',
    [1] _readyState: 2,
    [1] _receiver: null,
    [1] _sender: null,
    [1] _socket: null,
    [1] _bufferedAmount: 0,
    [1] _isServer: false,
    [1] _redirects: 0,
    [1] _url: 'wss://host/connection/websocket',
    [1] _req: null
    [1] },
    [1] [Symbol(kType)]: 'error',
    [1] [Symbol(kError)]: Error: certificate has expired
    [1] at TLSSocket.onConnectSecure (_tls_wrap.js:1321:34)
    [1] at TLSSocket.emit (events.js:223:5

    My code

    var centrifuge = new Centrifuge('wss://host/connection/websocket',{
    websocket: WebSocket,
    debug: true,
    });

    centrifuge.setToken("JWT");

    centrifuge.subscribe("news", callbacks);

    centrifuge.connect();

    Alexander Emelin
    @FZambia
    Certificate has expired
    Anish Menon
    @anishmenon
    Certificate has expired
    ?
    SSL
    @FZambia
    its not
    Alexander Emelin
    @FZambia
    It's in your error description, I have no other suggestion.
    Anish Menon
    @anishmenon
    SSL is not expired using certbot generated cert properly configured too on nginx
    and https is wokring
    garrensweet
    @garrensweet:matrix.org
    [m]
    I'm attempting to debug some Centrifugo channel errors I'm getting intermittently but having trouble location where exactly the log location is within the centrifugo docker image. Any tips?
    Pavel Shatalov
    @seidju

    Hey everyone! Trying to configure publish proxy subscription:
    "proxy_publish_endpoint":"http://localhost:3000/centrifugo/publish"

    So using Go it looks something like this:

    func createServer() {
          http.HandleFunc("/centrifugo/publish", rootHandler)
          http.ListenAndServe(":3000", logRequest(http.DefaultServeMux))
    }
    
    func rootHandler(w http.ResponseWriter, r *http.Request) {
         log.Printf("Endpoint accessed")
    }
    
    func logRequest(handler http.Handler) http.Handler {
        return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
            log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL)
            handler.ServeHTTP(w, r)
        })
    }

    But when my client published something into a channel I've got nothing on backend-side, could anyone tell me what I'm doing wrong (fyi, noobie in Go), thanks for any help !

    Alexander Emelin
    @FZambia
    @seidju hello, I think you could forget adding publish or proxy_publish options for a channel namespace.
    @garrensweet:matrix.org Centrifugo logs to stdout, so docker logs command should show logs
    Pavel Shatalov
    @seidju
    @FZambia thanks, but it seems problem is somewhere else, because its also doesn't work with other proxy endpoints (i.e connect, rpc, refresh), maybe there're problems with environment? I started Centrifugo via docker and backend app is run locally... I also write iOS client, which doing all publishing actions.
    So here's part of my config.json file:
    {
    ...
     "allowed_origins": ["ws://localhost:8000", "http://localhost:3000"],
     "debug": true,
     "log_level": "debug",
    
     "proxy_connect_endpoint": "http://localhost:3000/centrifugo/connect",
     "proxy_connect_timeout":  "1s",
    
     "proxy_refresh_endpoint": "http://localhost:3000/centrifugo/refresh",
     "proxy_refresh_timeout":  "1s",
    
     "proxy_rpc_endpoint": "http://localhost:3000/centrifugo/rpc",
     "proxy_rpc_timeout":  "1s",
    
     "proxy_subscribe_endpoint": "http://localhost:3000/centrifugo/subscribe",
     "proxy_subscribe_timeout":  "1s",
     "proxy_subscribe": true,
    
     "proxy_publish_endpoint": "http://localhost:3000/centrifugo/publish",
     "proxy_publish_timeout":  "1s",
     "proxy_publish": true,
    
     "namespaces": [
        {
          "name": "users",
          "publish": true,
          "history_size": 10,
          "history_ttl": "300s"
        }
      ]
    }
    7 replies
    Artyom Zavrazhyn
    @Zavrik94

    @FZambia Hi. I try to reserach but didn`t find anything. Maybe you can ask my question. I install Centrifugo by Docker. It work correctly and i try to set up publish proxy. For receive messages from client on my backend.

      "proxy_publish_endpoint": "http://my_app_in_docker/api/v1/centrifugo/get",
      "proxy_publish_timeout":  "1s",
      "proxy_publish": true

    How i must set up config?

    4 replies
    xiaoxiunique
    @xiaoxiunique
    How to set header when centrifugal-js connects to the server?
    xiaoxiunique
    @xiaoxiunique
    It is not possible to connect directly with the main.go index.html on the official website.
    1 reply
    image.png
    Artyom Zavrazhyn
    @Zavrik94
    @FZambia Hello. Is it possible to set up Authorization header and Cookie to websocket connection, and using proxy redirect connection to backend with this headers for Backend Auth?
    1 reply
    Ryan Mills
    @rm14_gitlab
    Hey guys, quick question here. I have an issue with centrifugo sometimes 'closing' channels. After a period of time, channels will not be active even if users subscribe to them. I can see that the data is arriving into the correct redis pub/sub channel so it looks like an issue with centrifugo. Has anyone come across something like this before? Its really confusing seeing that other channels work perfectly fine yet some seem to randomly break
    3 replies
    Alexander
    @xenx-efy
    изображение.png
    Hi there. Does anybody know why I receive response from websoket with double data? I checked, request is correct. 👆
    Alexander Emelin
    @FZambia
    @xenx-efy hello, it's a protocol implementation detail, so it's a normal thing and not a bug
    Alexander
    @xenx-efy
    Interesting, thank you for answer)
    Alexander Emelin
    @FZambia
    Welcome, you are not the first asking about this - a bit confusing naming here..
    Pavel Shatalov
    @seidju
    @FZambia Hi! I'm using Swift example with SwiftCentrifugeSDK and I'm curious is there any way to automatically refresh JWT connection token using this SDK (or maybe some config in Centrifugo)? Or I should manually ask my backend to get new token and re-connect to Centrifugo?
    Pavel Shatalov
    @seidju
    Also, should client subscribes to personal channel if Centrifugo configuration already contains user_subscribe_to_personal ?
    Alexander Emelin
    @FZambia
    @seidju hi! swift client contains a callback which is when set called at the time when token should be refreshed - https://github.com/centrifugal/centrifuge-swift/blob/master/Sources/SwiftCentrifuge/Delegate.swift. but the way you will get a new token from backend is up to developer - in most cases you will ask backend over http for token
    Regarding personal channel subscription - that option should be enough, non-anonymous users will be subscribed to a server-side personal channel. By default its #<user_id>
    Alexander Emelin
    @FZambia
    It's also possible to set a namespace for user personal channel
    Junaidy
    @junaidy-johm
    Any tutorial in YouTube about chat app with centrifuge? Thanks
    1 reply
    Pavel Shatalov
    @seidju
    @FZambia Thanks a lot!
    Alexander Emelin
    @FZambia

    Hello! Just released Centrifugo PRO v3.1.0 - this is the first release of PRO version. Don't forget that you can check out all Centrifugo PRO features in sandbox mode – everything is available, just with restrictions on number of connections, API calls and node amount.

    https://github.com/centrifugal/centrifugo-pro/releases/tag/v3.1.0

    Alexander Emelin
    @FZambia
    Hey folks, Centrifugo v3.1.1 released! https://github.com/centrifugal/centrifugo/releases/tag/v3.1.1
    Alexander Emelin
    @FZambia
    Hey folks, me and @anton_silischev just published a post about Centrifugo and Laravel integration. Take a look – feedback is much appreciated, planning to post on Reddit tomorrow: https://centrifugal.dev/blog/2021/12/14/laravel-multi-room-chat-tutorial
    Pavel Shatalov
    @seidju
    Hi @FZambia! Could you please tell is there any way to notify backend when centrifugo client did disconnect from socket? For example, app was in background and ws was stopped. Couldn't find information in docs. Thanks a lot!
    Alexander Emelin
    @FZambia
    Centrifugo v4 roadmap ^^
    Alex Davidovich
    @alxsad
    Hi @FZambia Could you please help me with centrifugo client written in go? There is callback func (h *centrifugoTopicEventHandler) OnPublish(sub *centrifuge.Subscription, e centrifuge.PublishEvent) but on each message from topic e.ClientInfo always is nil. Is it expected behaviour? Thank you.
    @FZambia maybe is there other way to skip messages from topic sent by me?
    Alexander Emelin
    @FZambia
    @alxsad hello! e.ClientInfo is filled when publication issued using client protocol (using client.Publish method). If publication is sent over server API then it's always nil. To skip messages:
    • you can include client ID that sent message into message payload and have skip logic based on it
    • you can include some unique page identifier instead of ID into message payload
    • there is also field Meta in Publication - https://github.com/centrifugal/protocol/blob/master/definitions/client.proto#L134 - it was just recently added, needs some work to support it throughout Centrifugo stack. It will allow including some additional information into Publication which can be outside of actual Payload
    • you can also make sure that message processing is idempotent - i.e. processing message twice does not lead to side effects in your app
    Alex Davidovich
    @alxsad
    Thank you @FZambia