I use a browser - Opera version 11.52.
I use version of the node.js - v0.4.12 and socket.io version 0.8.5.
I tried this example - https://github.com/LearnBoost/socket.io/tree/master/examples/chat
This page starts up and displays only the message - Connecting to socket.io server = In opera.
Other browsers work properly - Firefox, IE, Chrome.
I tried to debug node.js - No errors.
Thank you for your help and advice!
Try following this guide: https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO and configuring the transports setting to something that prioritizes xhr-polling over websockets and see if that resolves the issue. My experience with using socket.io on production web apps has been that the websocket transport is not as reliable as xhr-polling.
Did you try to enable Websocket? Put in your toolbar, then check, then save.
opera:config#UserPrefs|EnableWebSockets
Related
I have problem with websocket connection on heroku.
Not sure where is the problem, because on other browsers it works.
A similar issue was here:
Firefox Websocket security issue
If I understand correctly:
Something related to Heroku and backend is missing regards to security. Only Firefox care about this issue, other browsers not. Probably I can somehow ignore this error on firefox and allow a connection.
Below is the screenshot The connection used to fetch this resource was not secure - what exactly does it mean and how debug what and where is missing here?
After research, the reason for it was proxy on Firefox.
If someone would have a similar issue, please do:
Open the Firefox
Go to about:preferences
Open Network Settings
Configure Proxy Access to the Internet and be sure there is "No proxy"
After installing node.js, I followed this tutorial to start a simple chat server. It was very easy to setup and is working, but I have noticed two problems:
1.) I am getting this warning from socket.io
info - socket.io started
debug - served static /socket.io.js
debug - client authorized
info - handshake authorized 1385647068766475337
debug - setting request GET /socket.io/1/websocket/1385647068766475337
debug - set heartbeat interval for client 1385647068766475337
warn - websocket connection invalid
This doesn't make sense to me because I didn't touch anything with socket.io and I am using the latest chrome version (23) which I know supports websockets (I am able to successfully connect to them with PHP-Websockets). It continues to use XHR instead, but I am really interested in getting the Websocket functionality working.
2.) When I go to localhost:8080 to connect to the chat server, it takes around 7-8 seconds for it to prompt me for my name and actually connect me to the server. I have a feeling this may be because it is reverting to XHR, but I don't really know much about it so I can't say. Any thoughts?
I saw this behaviour when using an older version of socket.io with later chrome builds (and other browsers also). It would timeout then fallback to xhr polling. To check your version of the socket.io library you are using, at your shell (linux/unix) type:
npm ls| grep socket.io
And it should tell you the version. The latest at this time is 0.9.13, which works.
If you are running the tutorial from http://psitsmike.com note that the package.json file hardcodes an older version of socket.io which doesn't work with the latest browsers.
Hope this helps.
I too was facing similar issues.
Your case -
Try deleting your cookies, sometimes the xhr-polling option once connected successfully is saved to cookies and reused every next time. Similar question answered here
Also debug - served static /socket.io.js sometimes come when the socket.io file is referred incorrectly inside the html or jade template file. Try correcting the script src link in case it wrong. It should be something like - var socket = io.connect('http://localhost:3000'); OR you can also try removing the link all together like this - var socket = io.connect();
Hope it helps.
I had the exact same issue. this might be old. but My setup is on digitalocean. what happens is that usually people who run node apps on one server use nginx for the port listen and node under its own dedicated port. nginx did not forward the websocket port to the node, only port 80 which nodejs was not initialised to begin with.
http://nginx.org/en/docs/http/websocket.html
You need to make sure your nginx is configured properly for this.
I just added the port to the io.connect directly connecting to the node server and avoiding nginx.
I am having some issues with websockets and socket.io.
On localhost, socket.io seems to work ok but when I push to production on no.de, on FF 11 and Chrome 18.0, it takes forever to connect and after about 5 seconds the connection is lost and not reestablished. It works fine on Safari. This is with and without configuring the transports with websocket included.
When I configure the transports without 'websocket', all is well, connections are quick and not dropped. So I have it working now, but not as I would like it to.
Two things I am confused on:
- I thought these browser versions supported websockets.
- I thought socket.io would default to the next best transport solution.
Any ideas on what I'm doing wrong?
It seems that No.de servers don't proxy correctly. I don't know the details. I've found the info here:
http://discuss.joyent.com/viewtopic.php?id=30975
You won't get the job done unless you pay! As always. :-)
I installed node.js and the module socket.io (http://socket.io).
The chat example of socket.io works just fine for me, typing in my
browser
http://localhost:3000
But I cannot get anything to work using another IP, eventhough the
server listens on all interfaces (i.e. 0.0.0.0). My ethernet
interface has the address 192.168.1.1, typing in my browser
http://192.168.1.1:3000
I get the chat webpage, but my Firebug (still on the same computer)
says:
NetworkError: 400 Bad Request
and the websocket connection is not established. The result is, that I
cannot reach my websockets from the outside, whatever code I write.
I use node v0.6.12, firefox 11.0, Ubuntu 11.10.
Questions:
1) Can anybody confirm this error?
2) How can I reach a websocket from another computer than localhost?
3) Is there any socket.io example where the connection works from the outside on a normal ubuntu installation?
Thanks!
Solved: disable proxy in Firefox
Apparently my Ubuntu installation started ziproxy automatically
and configuered Firefox to use it. Setting Firefox to "no proxy"
solved the problem. Now I can connect to my websockets from the
outside.
Share your code.
are you using express??
use --> app.listen(3000);
I have an application that saves a cooke and would like to get hold of that cookie from node.js and Socket.io, while the application is running on the same server as my node app, they are on different ports.
Can I do this and how? (needs to work in IE 8+, FF, Chrome and Safari)
I am an idiot and forgot that socket.io works both ways, so I can just send the cookie to the server on connecting to it! - Here's the link that helped me out: Stack Overflow question