Software Archive
Read-only legacy content
17061 Discussions

Intel XDK, Node.js and Socket.io.js

Ahmet_İ_
Beginner
662 Views

Hello everyone,

I'm trying to build a client server application. I will use Node.js and socket.io. UI part is not important.

I only want to know; how can i solve "not defined" error. 

I have two files; index.html and app.js.

index.html contains "<script type="application/javascript" src="/socket.io/socket.io.js"></script>"

app.js contains "var socket = io.connect();" command. But Editor gives me JSHint Problems: "io is not defined. (W117)"

I'm always getting this "not defined" error when i write require('blabla.js'), JQuery. 

There is no any article or video about integrating  a socket.io and node.js in Intel XDK. I really like to use Intel XDK. I hope i can find a solution to use ide.

What am i missing, can you help pls?

(Sorry for bad english)

0 Kudos
3 Replies
Ad
New Contributor III
662 Views

There are special comment lines, see below, where you can 'define' your JSLint  vars e.g:

/*jslint browser:true, devel:true, white:true, vars:true */
/*global $:false, intel:false app:false, dev:false, cordova:false */

add io:true to the jslint comment line and your "not defined" error is solved.
/*jslint browser:true, devel:true, io:true, white:true, vars:true */

0 Kudos
PaulF_IntelCorp
Employee
662 Views

You'll need to look over the JSHint and JSLint docs to get info on how the special comment lines work.

Note that you are not able to debug that nodeJS code with the XDK -- it will only help you debug client-side HTML5 code.

0 Kudos
Nils_F_
Beginner
662 Views

Hi Ahmet,

could you share your code with me? I have been trying to get this running but don't get it to work. I always get http://<myserver>/socket.io/1/?t=1439847508698 error. I have the same setup nodejs and socket.io.

Thank you very much.

Regards, Nils

0 Kudos
Reply