How install socket.io?

243 views
Skip to first unread message

Volgar Volgar

unread,
Dec 24, 2011, 4:58:44 PM12/24/11
to clou...@googlegroups.com
I create new app and can`t start it and get Error: Cannot find module 'socket.io'.
How i can install this module on your server?

Volgar Volgar

unread,
Dec 25, 2011, 5:57:11 AM12/25/11
to clou...@googlegroups.com
I just installed socket.io and all the other missing modules in the repository to upload in the application directory.
Now in the log:
25 Dec 11:47:27 - Inside Node Virtual Machine
25 Dec 11:47:27 - Owning user: 501
25 Dec 11:47:27 - User Changed: 501
25 Dec 11:47:27 - Checking for /etc
25 Dec 11:47:27 - Update /etc/resolve.conf with Googles DNS servers..
25 Dec 11:47:27 - Checking for /tmp
25 Dec 11:47:27 - Checking for /mnt
25 Dec 11:47:27 - Setting up sandbox..
25 Dec 11:47:27 - Munging require paths..
25 Dec 11:47:27 - Globalizing Buffer
25 Dec 11:47:27 - Reading startup file server.js...
25 Dec 11:47:27 - Final user check: 501
25 Dec 11:47:27 - Cloudnode wrapped script starting (13642) at Sun Dec 25 2011 11:47:27 GMT+0100 (UTC)
  [36minfo  - [39m socket.io started
25 Dec 11:47:27 - [INFO] Cloudnode listening on port: 8275
Socket-Chat listening on port 8275.. Go to http://<this-host>:8275

I tried these settings to access the port.
 In a flash client: socket = new FlashSocket("avatargame.cloudno.de:8275");
 In websocket: ws = new WebSocket("ws://avatargame.cloudno.de:8275/");
Initiation socket.io in index.html: <script src="/socket.io/socket.io.js" charset="utf-8"></script>
App is started now, but connection is no. I try use "localhost", but it does not help. 

Volgar Volgar

unread,
Dec 25, 2011, 6:42:31 AM12/25/11
to clou...@googlegroups.com
I created new simple app - a simple text chat. It does not work too. Probably still a problem to connect to socket.io and other modules. 
Tell me please how to do it correctly.

Hans Schroeder

unread,
Dec 25, 2011, 10:41:37 AM12/25/11
to clou...@googlegroups.com
For socket.io use the address of your application with port 80. The port shown (8275) is just used on the internal net.

Volgar Volgar

unread,
Dec 25, 2011, 10:56:39 AM12/25/11
to clou...@googlegroups.com
Thank you, Hans!
Text chat is now work normally. But avatargame is still not working. Most likely the problem now in websocket. As can be seen that socket.io creates handshakes.
25 Dec 16:47:26 - Cloudnode wrapped script starting (20242) at Sun Dec 25 2011 16:47:26 GMT+0100 (UTC)

  [36minfo  - [39m socket.io started
25 Dec 16:47:26 - [INFO] Cloudnode listening on port: 8275

Socket-Chat listening on port 8275.. Go to http://<this-host>:8275
    [90mdebug - [39m served static content /socket.io.js
  [90mdebug - [39m client authorized
  [36minfo  - [39m handshake authorized 972123751416996551
  [90mdebug - [39m served static content /socket.io.js
  [90mdebug - [39m client authorized
  [36minfo  - [39m handshake authorized 5868608972055698424

Volgar Volgar

unread,
Dec 26, 2011, 9:19:07 AM12/26/11
to clou...@googlegroups.com
Hi, Hans.

I apologize for probably stupid questions, because I'm flash developer and first encounter with the server. Possible solution to this problem will help the many who choose to use Websockets.
Here is describes an issue here that has a place in my application - https://github.com/gimite/web-socket-js

If you are NOT using web-socket-ruby or em-websocket as your WebSocket server, you need to place Flash socket policy file on your server. See "Flash socket policy file" section below for details. 

This implementation uses Flash's socket, which means that your server must provide Flash socket policy file to declare the server accepts connections from Flash.

If you use web-socket-ruby or em-websocket, you don't need anything special, because they handle Flash socket policy file request. But if you already provide socket policy file at port 843, you need to modify the file to allow access to Web Socket port, because it precedes what the libraries provide.

If you use other Web Socket server implementation, you need to provide socket policy file yourself. See Setting up A Flash Socket Policy File for details and sample script to run socket policy file server. node.js implementation is available here.

Actually, it's still better to provide socket policy file at port 843 even if you use web-socket-ruby or em-websocket. Flash always try to connect to port 843 first, so providing the file at port 843 makes startup faster.


Tell me please, how is it possible to implement on your hosting Flash socket policy file? Thanx.

Volgar Volgar

unread,
Dec 26, 2011, 9:21:31 AM12/26/11
to clou...@googlegroups.com
I try use crossdomain.xml in root my app, but it does not help.

<cross-domain-policy>
     <allow-access-from domain="*" to-ports="*" />
</cross-domain-policy> 

alexandre devaux

unread,
Sep 12, 2012, 12:57:19 PM9/12/12
to clou...@googlegroups.com
So how did you install socket.io on the cloudnode server?
Thanks!

Volgar Volgar

unread,
Sep 12, 2012, 1:37:03 PM9/12/12
to clou...@googlegroups.com
It was a long time ago and now I can not remember. Some git commands.

2012/9/12 alexandre devaux <heyth...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Cloudnode" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cloudnode/-/hNd_ig2xD-sJ.

To post to this group, send email to clou...@googlegroups.com.
To unsubscribe from this group, send email to cloudnode+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cloudnode?hl=en.



--
Best regards, Astraport Inc.

alexandre devaux

unread,
Sep 13, 2012, 12:25:18 PM9/13/12
to clou...@googlegroups.com
Super it works!
The way to do it:
  
     - make a json package file : for me: 

{
    "name": "socketio",
    "version": "0.0.1",
    "private": true,
    "dependencies": {
      "socket.io": "~0.9.6"
  },
  "engines": {
    "node": "0.6.x"
  }
}
       - put it on the main directory
       - push  
 then npm will be executed on the cloudenode side!

Hans Schroeder

unread,
Sep 13, 2012, 5:15:39 PM9/13/12
to clou...@googlegroups.com
Yes, that's the way to do. Package file support is rather new though. It was more complicated in the past.
Reply all
Reply to author
Forward
0 new messages