mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-12 00:17:56 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c173141f8b | ||
|
|
91cdddb32c | ||
|
|
4acf98db9d | ||
|
|
73cc5e2c66 | ||
|
|
58ac323423 | ||
|
|
cd2c5140f1 |
16
README.md
16
README.md
@@ -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.
|
||||
|
||||
|
||||
Submodule example/client updated: 7a5e2b8cac...a8efecaa56
Reference in New Issue
Block a user