Skip to content
This repository has been archived by the owner on Mar 27, 2018. It is now read-only.

Commit

Permalink
handle non-ws http serving documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronblohowiak authored and miksago committed May 22, 2010
1 parent 4c02672 commit 91c290a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ An example of a simple server that will echo the messages received back out.
});
});

// Handle HTTP Requests:
// Handle HTTP Requests that don't UPGRADE to websockets
server.addListener("request", function(req, res){
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('This is, infact a websocket server, but we can do http!\n');
res.end('We can handle normal connections too!\n');
});

Coupled with a websocket client like the `example.html`, and you have a working websocket chat client (sort of.)
Expand All @@ -50,7 +50,7 @@ The server acts like a normal http server in many respects, and exposes much of
methods. However, there are a few differences, and things that haven't yet been implemented.

`ws.creareServer()` returns an instance of `ws.Server`, which acts like `http.Server`. However, not all methods
and events that act on `http.Server` will act on `ws.Server`.
and events that act on `http.Server` will act on `ws.Server`. Your application can handle normal http requests by listening for the "request" event.

`ws.createServer()` and `ws.Server()` takes an options object as its only parameter. The options object has a these
defaults:
Expand Down Expand Up @@ -94,6 +94,7 @@ Emits when a websocket client connects to the server. The `connection` is an ins

Emits when a client connects using standard HTTP to the server.
This is the same as the `http.Server` `request` event.
Use this to handle non-WebSocket connections.

### Event: stream ###

Expand Down

0 comments on commit 91c290a

Please sign in to comment.