Coly010 Posted May 15, 2015 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
Dayo Posted May 15, 2015 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
Coly010 Posted May 15, 2015 Author Posted May 15, 2015 Or not... still having the same problems :/ Have no idea whats going on lol Quote
Coly010 Posted May 15, 2015 Author Posted May 15, 2015 Got it working! Thanks for all the help guys? [MENTION=68711]KyleMassacre[/MENTION] can you lock this or delete? :) Quote
KyleMassacre Posted May 15, 2015 Posted May 15, 2015 Can you post what you did just in case someone else runs into the problem? 1 Quote
Coly010 Posted May 15, 2015 Author 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
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.