-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
## The CometD Project | ||
|
||
### CometD client for NodeJS | ||
### CometD NodeJS Client | ||
|
||
Adapter code that allows the [CometD client JavaScript library](https://github.com/cometd/cometd-javascript) to run in a NodeJS environment. | ||
This project implements adapter code that allows the [CometD JavaScript Client](https://github.com/cometd/cometd-javascript) to run in a NodeJS environment. | ||
|
||
The adapter code exports an implementation of `XMLHttpRequest` so that the CometD JavaScript Client works in NodeJS as it does within a browser environment. | ||
|
||
WebSocket is not (yet) supported. | ||
|
||
### NPM Installation | ||
|
||
Firstly, you need to install the CometD NodeJS Client: | ||
|
||
``` | ||
npm install cometd-nodejs-client | ||
``` | ||
|
||
The CometD NodeJS Client does not depend on the CometD JavaScript Client; you need the CometD JavaScript Client to develop your applications. | ||
|
||
Therefore, you need to install the CometD JavaScript Client, version 3.1.2 or greater: | ||
|
||
``` | ||
npm install cometd | ||
``` | ||
|
||
### Usage | ||
|
||
```javascript | ||
// Run the adapter code. | ||
// Run the adapter code that implements XMLHttpRequest. | ||
require('cometd-nodejs-client').adapt(); | ||
|
||
// Your normal CometD client application here. | ||
var lib = require('cometd'); | ||
var cometd = new lib.CometD(); | ||
... | ||
``` | ||
|
||
See [here](https://github.com/cometd/cometd-javascript/blob/master/README.md) for an example CometD client application. |