View Single Post
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 11-10-2013 , 01:40   Re: [DEV] WebSocket Server - Direct connection between webbrowser and gameserver
Reply With Quote #46

Quote:
Originally Posted by n___ View Post
I get the same error as above when attempting to connect with NodeJS and socket.io
Not familiar with sp, any pointers on where I might be going wrong?

The client.html.txt code works to send messages to the server, but not the following node code

Code:
var io = require('socket.io-client'),
        socket = io.connect('myhost.com', {
            port: 12345
        });


socket.on('connect', function() {
    socket.send("Hello Websockets from Node!");
});
If you're trying to communicate with the server using anything besides a web browser (in this case, it looks like you're trying to facilitate communication between a game server and a Node.js program?), you should really use plain sockets.
__________________
Dr. McKay is offline