13 lines
389 B
TypeScript
13 lines
389 B
TypeScript
![]() |
import type { ServerWebSocket } from "bun";
|
||
|
import type { WebSocketData } from "@WS/.";
|
||
|
import type { WebSocketDataType } from "@/types";
|
||
|
import datasquirel from "@moduletrace/datasquirel";
|
||
|
const EJSON = datasquirel.client.utils.EJSON;
|
||
|
|
||
|
export default function sendData(
|
||
|
ws: ServerWebSocket<WebSocketData>,
|
||
|
data: WebSocketDataType
|
||
|
) {
|
||
|
ws.send(String(EJSON.stringify(data)));
|
||
|
}
|