We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am having an issue setting up a simple connection from a browser to the node example given.
Server code:
var http = require("http"); var StompServer = require('stomp-broker-js'); var server = http.createServer(); var stompServer = new StompServer({server: server}); server.listen(9999); stompServer.on('connecting', function() { console.log("CONNECTING") }) stompServer.subscribe("/**", function(msg, headers) { var topic = headers.destination; console.log(topic, "->", msg); }); stompServer.send('/test', {}, 'testMsg');
Browser code:
import * as Stomp from '@stomp/stompjs'; // connect to local server const ws = new WebSocket('ws://localhost:9999'); const client = Stomp.over(ws); client.debug = () => undefined; client.connect( {}, frame => { console.log('Connected', frame); }, (error: any) => console.log('Error', error) );
I am just copying what is in the docs as regards the server code. I am using @stomp/stompjs client to connect.
The error I get is: WebSocket connection to 'ws://localhost:9999/' failed: Error during WebSocket handshake: Unexpected response code: 400
WebSocket connection to 'ws://localhost:9999/' failed: Error during WebSocket handshake: Unexpected response code: 400
The text was updated successfully, but these errors were encountered:
+1 I am experiencing the exact same issue
Sorry, something went wrong.
You have to add /stomp at the end of the url. So in your case it should be: const ws = new WebSocket('ws://localhost:9999/stomp');
const ws = new WebSocket('ws://localhost:9999/stomp');
The default value of config.path is "/stomp" base on the code https://github.com/4ib3r/StompBrokerJS/blob/master/lib/config.js#L7
No branches or pull requests
I am having an issue setting up a simple connection from a browser to the node example given.
Server code:
Browser code:
I am just copying what is in the docs as regards the server code. I am using @stomp/stompjs client to connect.
The error I get is:
WebSocket connection to 'ws://localhost:9999/' failed: Error during WebSocket handshake: Unexpected response code: 400
The text was updated successfully, but these errors were encountered: