@pluv/platform-node v0.17.3
Disclaimer: This package is currently in preview and may have breaking changes between versions. Please wait for a
v1.0.0
stable release before using this in production.
@pluv/platform-node
👉 See full documentation on pluv.io. 👈
Installation
# npm
npm install @pluv/platform-node ws @types/ws
# yarn
yarn add @pluv/platform-node ws @types/ws
# pnpm
pnpm add @pluv/platform-node ws @types/ws
Basic Example
import { createIO } from "@pluv/io";
import { platformNode } from "@pluv/platform-node";
import Http from "http";
import WebSocket from "ws";
export const io = createIO({
platform: platformNode(),
});
const server = Http.createServer();
const wsServer = new WebSocket.Server({ server });
const parseRoomId = (url: string): string => {
/* get room from req.url */
};
wsServer.on("connection", async (ws, req) => {
const roomId = parseRoomId(req.url);
const room = io.getRoom(roomId);
await room.register(ws);
});
Reference
Check us out on GitHub for more information on how to use @pluv/io
.
24 days ago
25 days ago
25 days ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
9 months ago
9 months ago
8 months ago
8 months ago
9 months ago
7 months ago
9 months ago
6 months ago
5 months ago
9 months ago
10 months ago
10 months ago
12 months ago
12 months ago
12 months ago
1 year ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago