Closed hamedaravane closed 8 months ago
Hello @hamedaravane ,
Check out Centrifugo server logs, often the reason is described there. Possibly the reason is misconfigured allowed_origins
option in Centrifugo configuration.
Hi @FZambia, Thanks for your response. I don't have access to the centrifuge server, so I can't check its logs. Is there a way to handle this issue like CORS in REST API? For example, can we set up a proxy or are there other solutions?
I really appreciate your time and help.
I am not 100% sure you get allowed origins problem. If yes – I think you can try proxy approach though it may be more difficult than with HTTP-based CORS since WebSocket is less common, and I personally never did this myself so can't recommend something. If you connect from the backend environment, the next thing you may come across when connecting is connection authentication - JWT or Cookie-based, depends on Centrifugo configuration. What is the use case where you don't have access to server BTW?
Hi there! I hope this message finds you well. I'm currently facing an issue connecting to a centrifuge server in an Angular application. The transport gets closed immediately after I send the connection request. I've gone through all the open issues in this repository and tried the suggested solutions, but unfortunately, the problem persists.
Summary:
Details:
CentrifugeAbstract
class wraps centrifuge methods.Websocket
class extendsCentrifugeAbstract
and connects to Centrifuge with a specific URL.Websocket
is called to connect and subscribe to a channel.Chrome Developer Console:
Actions Taken:
Request:
Solution for the websocket transport closing issue
Environment:
Operating system: macOs Sonoma 14.2.1 Browser: Google Chrome 123.0.6312.59 (Official Build) (x86_64) Angular version: 17.2.0 Centrifuge version: 5.0.2
Thank you for your time and assistance.