Coly010 Posted May 15, 2015 Share Posted May 15, 2015 I'm having some difficulties getting socket.io up and running. It doesn't seem to be emitting events on the client side and when I load up dev tools in chrome I see this: my code is this: <script src="https://cdn.socket.io/socket.io-1.3.5.js"></script> <script>$(document).ready(function(){ var socket = io(); $("#entry").click(function() { socket.emit("connect", "USER"); }); });</script> and yes, I have socket.io 1.3.5 installed. any ideas? Quote Link to comment Share on other sites More sharing options...
Dayo Posted May 15, 2015 Share Posted May 15, 2015 You are not connected to a socket (unless there is more code) you need [js]var socket = io.connect(); [/js] rather then var socket = io(); Quote Link to comment Share on other sites More sharing options...
Coly010 Posted May 15, 2015 Author Share Posted May 15, 2015 Ahhhh. Makes sense. Thanks! Quote Link to comment Share on other sites More sharing options...
Coly010 Posted May 15, 2015 Author Share Posted May 15, 2015 Or not... still having the same problems :/ Have no idea whats going on lol Quote Link to comment Share on other sites More sharing options...
Coly010 Posted May 15, 2015 Author Share Posted May 15, 2015 Got it working! Thanks for all the help guys? [MENTION=68711]KyleMassacre[/MENTION] can you lock this or delete? :) Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 15, 2015 Share Posted May 15, 2015 Can you post what you did just in case someone else runs into the problem? 1 Quote Link to comment Share on other sites More sharing options...
Coly010 Posted May 15, 2015 Author Share Posted May 15, 2015 I had to uninstall and reinstall the node_modules then in my server code: var express = require('express'); var app = express(); var http = require('http').createServer(app); var server = app.listen(3000); var io = require('socket.io').listen(server); client: <script src='/socket.io/socket.io.js'></script> <script> var socket = io.connect(); </script> 1 Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 16, 2015 Share Posted May 16, 2015 Ok good enough haha Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.