Skip to content
New issue

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

lost connect to stompEndPoint #1

Open
mastershashi opened this issue Sep 6, 2018 · 1 comment
Open

lost connect to stompEndPoint #1

mastershashi opened this issue Sep 6, 2018 · 1 comment

Comments

@mastershashi
Copy link

Hi ,

For me Socket JS is unable to make a connection with the server in cloud foundry .
here is my code
var socket = new SockJS('/websocket-example');
stompClient = Stomp.over(socket);
stompClient.connect({}, function (frame) {
setConnected(true);
console.log('Connected: ' + frame);
showGreeting("Connected");
stompClient.send("/app/user", {}, JSON.stringify({'name': $("#name").val()}));
if (stompClient !== null) {
stompClient.disconnect();
}
setConnected(false);
console.log("Disconnected");
});

In Localhost it is working fine but in in cloud foundry it is not working it unable to establish the connection
Log:
Opening Web Socket...

2sockjs.min.js:2
GET https://websocket-cf.cfapps.ondemand.com/websocket-example/info?t=1536215752774 404 (Not Found)
r._start @ sockjs.min.js:2
(anonymous) @ sockjs.min.js:2
setTimeout (async)
r @ sockjs.min.js:2
n @ sockjs.min.js:3
n @ sockjs.min.js:2
n._getReceiver @ sockjs.min.js:2
n.doXhr @ sockjs.min.js:2
(anonymous) @ sockjs.min.js:2
setTimeout (async)
n @ sockjs.min.js:2
r @ sockjs.min.js:2
sendName @ app.js:37
(anonymous) @ app.js:67
dispatch @ jquery.js:5110
q.handle @ jquery.js:4918
localhost/:1
Failed to load https://websocket-cf.cfapps.sap.hana.ondemand.com/websocket-example/info?t=1536215752774:

Can you please tell me what could be the possible reason for this ?

@dk2k
Copy link
Owner

dk2k commented Sep 7, 2018

Hi mastershashi,
I can just point a couple of directions.
Please check out how the WAR got deployed on websocket-cf.cfapps.sap.hana.ondemand.com. Can it be that the context /websocket-example differs? May be the app was deployed this way: https://websocket-cf.cfapps.sap.hana.ondemand.com/info?t=1536215752774 - with empty context?
Or with additional level in context, say https://websocket-cf.cfapps.sap.hana.ondemand.com/my_apps/websocket-example/info?t=1536215752774
Was the app deployed on port 80? Maybe you need to specify a port explicitly?
Are there any access restrictions on the cloud? Is port 8080 open?
And the common advice: search for the difference between localhost and cloud deployments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants