8

I wanted to learn how to do a web-based real time multiplayer game and recently, I found this one and tried it. Took me a lot of time to understand it since I have no background on js, websockets and nodes. Anyways I've done most parts of that blog but I kept getting this error.

The following error shows on the javascript console:

WebSocket connection to 'ws://localhost/socket.io/?EIO=2&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 200

I have already started the game server with the line: C:\xampp\htdocs\node game.js and it only shows something like this _, an underscore blinking. So blankly its nothing, but I've read questions similar with problems and they said something like it is already working but it not just showing anything which it not really a bad thing.

I am really new to this kind of stuff so please, if anyone out there knows how to solve this problem please respond. It will be so much appreciated.

KYOUMAH
  • 89
  • 1
  • 7
  • 1
    You solved your 200 response ? I have the same issue on a Stomp Spring stack. – Stephane Nov 14 '14 at 14:59
  • Unfortunately not. Since no one responded, I never had any idea on solving this. – KYOUMAH Feb 09 '15 at 09:46
  • Don't know if it might help, maybe this post can help you? [Status 200](http://stackoverflow.com/questions/29829597/i-get-a-status-200-when-connecting-to-the-websocket-but-it-is-an-error) – Jean-Louis Oct 04 '16 at 03:45
  • what operating system are you running on? Do you have a proxy server running? – rajender sohi Nov 23 '16 at 06:48
  • You're right in the fact that the underscore is the only thing showing. However, you should maybe debug a little, and print something to the console when it's working (ie. `console.log("Hello, World!")`). – arbybruce Apr 09 '17 at 01:04
  • Hi ! Can you please post any code you use on your NodeJS server that refers to SocketIO here ? Thanks in advance. – Pierre C. Nov 17 '17 at 05:38
  • @KYOUMAH did you find an answer to your issue ? Please provide me more info so I can help you if you didn't :) – Pierre C. Nov 23 '17 at 16:48

1 Answers1

0

As tutorial says you should see

socket.io started.

You need to make sure that you access all your static files from the proper directory. Have you checked final code of that tutorial?

Once the game server is running, open the index.html file within the browser.

Refresh the page and you should see a message in the console stating that you're now connected to the socket server.