mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
docs(readme) example: io.listen -> new Server (#341)
This commit is contained in:
parent
5d93d5752c
commit
5e63a524c1
2 changed files with 9 additions and 8 deletions
13
HELP.md
13
HELP.md
|
|
@ -665,7 +665,7 @@ And create `index.js`:
|
|||
```js
|
||||
import http from 'http';
|
||||
import cloudcmd from 'cloudcmd';
|
||||
import io from 'socket.io';
|
||||
import {Server} from 'socket.io';
|
||||
import express from 'express';
|
||||
|
||||
const app = express();
|
||||
|
|
@ -673,7 +673,7 @@ const port = 1337;
|
|||
const prefix = '/';
|
||||
|
||||
const server = http.createServer(app);
|
||||
const socket = io.listen(server, {
|
||||
const socket = new Server(server, {
|
||||
path: `${prefix}socket.io`,
|
||||
});
|
||||
|
||||
|
|
@ -718,9 +718,10 @@ Here is example with two `Config Managers`:
|
|||
```js
|
||||
import http from 'http';
|
||||
import cloudcmd from 'cloudcmd';
|
||||
import io from 'socket.io';
|
||||
const app = require('express')();
|
||||
import {Server} from 'socket.io';
|
||||
import express from 'express';
|
||||
|
||||
const app = express();
|
||||
const port = 8000;
|
||||
const prefix1 = '/1';
|
||||
const prefix2 = '/2';
|
||||
|
|
@ -728,11 +729,11 @@ const prefix2 = '/2';
|
|||
const {createConfigManager} = cloudcmd;
|
||||
|
||||
const server = http.createServer(app);
|
||||
const socket1 = io.listen(server, {
|
||||
const socket1 = new Server(server, {
|
||||
path: `${prefix1}/socket.io`,
|
||||
});
|
||||
|
||||
const socket2 = io.listen(server, {
|
||||
const socket2 = new Server(server, {
|
||||
path: `${prefix2}/socket.io`,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ And create `index.js`:
|
|||
```js
|
||||
import http from 'http';
|
||||
import cloudcmd from 'cloudcmd';
|
||||
import io from 'socket.io';
|
||||
import {Server} from 'socket.io';
|
||||
import express from 'express';
|
||||
|
||||
const app = express();
|
||||
|
|
@ -80,7 +80,7 @@ const port = 1337;
|
|||
const prefix = '/';
|
||||
|
||||
const server = http.createServer(app);
|
||||
const socket = io.listen(server, {
|
||||
const socket = new Server(server, {
|
||||
path: `${prefix}socket.io`,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue