Saturday 9 January 2016

Can you use socket.io scripts in an external jquery file?

I'm working with a node application using socket.io and express server. It's just a simple chat application that I am trying to learn these languages and framework with. My question is pretty simple, but I couldnt find anything on google about it. All of the socket.io and jquery in all the examples are in the actual HTML source file. I am doing it different, by putting the jquery in a separate file. Can I use socket.io in an external jQuery file? Like will this work:var socket = socket.io();socket.emit("some function", value, function(data)Because I can get it to work internally with the HTML file, but once I separate it, it stops working..but I dont know if this is because I am doing it wrong or if it will not work that way..Anyone have any experience with this? And I do have it in a 'public' folder with the css and jquery, and that works with node when I run the app. It is just when I try to use socket.io it stops working.Thank you for any help, I am still learning.

Submitted January 10, 2016 at 02:04AM by ryohazuki88

No comments:

Post a Comment