Skip to content

Tag: websocket

How to properly refuse websocket upgrade request?

Sometimes I want to refuse a http client’s request to upgrade connection to websocket. Code (using go’s Gin and gorilla/websocket framework:) To allow upgrade: To refuse upgrade (due to invalid request params): Explaination: Here to refuse the upgrade I just return a http 400 code, then terminate the connection, and didn’t do the upgrade at all. The issue The problem

Stomp Client in Web Browser without Websockets

I have a Node.js app in which I use stomp-client to connect and subscribe to an ActiveMQ topic without websockets. My code is the same as this example: Now, I want to do the same thing, but with a Vue.js application. So, I want to subscribe to an ActiveMQ topic in the browser (i.e., in JavaScript, not in Node.js).