Compare commits

..

6 Commits
0.5 ... 0.5.3

Author SHA1 Message Date
Guillermo Rauch
c173141f8b Updated client 2010-08-01 14:05:55 -07:00
Guillermo Rauch
91cdddb32c Updated client to 0.5.2 2010-08-01 11:27:43 -07:00
Guillermo Rauch
4acf98db9d Fixed require path in README (thanks Tobsn) 2010-07-29 11:09:21 -07:00
Guillermo Rauch
73cc5e2c66 Updated client 2010-07-29 10:37:44 -07:00
Guillermo Rauch
58ac323423 Extended how to use section 2010-07-29 02:04:02 -07:00
Guillermo Rauch
cd2c5140f1 Updated client 2010-07-29 01:59:02 -07:00
2 changed files with 11 additions and 7 deletions

View File

@@ -8,21 +8,19 @@ The `Socket.IO` server provides seamless supports for a variety of transports in
- XHR Multipart Streaming
- Forever Iframe
Requirements
------------
## Requirements
- Node v0.1.102+
- [Socket.IO client](http://github.com/LearnBoost/Socket.IO) to connect from the browser
How to use
----------
## How to use
`Socket.IO` is designed not to take over an entire port or Node `http.Server` instance. This means that if you choose your HTTP server to listen on the port 80, `socket.io` can intercept requests directed to it and the normal requests will still be served.
By default, the server will intercept requests that contain `socket.io` in the path / resource part of the URI. You can change this (look at the available options below).
var http = require('http'),
io = require('./socket.io/socket.io.js'),
io = require('./path/to/socket.io'),
server = http.createServer(function(req, res){
// your normal server code
@@ -32,7 +30,13 @@ By default, the server will intercept requests that contain `socket.io` in the p
});
// socket.io, I choose you
io.listen(server);
var socket = io.listen(server);
socket.on('connection', function(client){
// new client is here!
client.on('message', function(){ … })
client.on('disconnect', function(){ … })
});
On the client side, you should use the [Socket.IO client](https://github.com/LearnBoost/Socket.IO) to connect.