import type { Message, Api } from '@remixproject/plugin-utils'; import { PluginClient, ClientConnector, Client } from '@remixproject/plugin'; import { IRemixApi } from '@remixproject/plugin-api'; export interface WS { send(data: string): void; on(type: 'message', cb: (event: string) => any): this; } /** * This Websocket connector works with the library `ws` */ export declare class WebsocketConnector implements ClientConnector { private websocket; constructor(websocket: WS); /** Send a message to the engine */ send(message: Partial): void; /** Get messae from the engine */ on(cb: (message: Partial) => void): void; } /** * Connect a Websocket plugin client to a web engine * @param client An optional websocket plugin client to connect to the engine. * * --------- * @example * ```typescript * const wss = new WebSocket.Server({ port: 8080 }); * wss.on('connection', (ws) => { * const client = createClient(ws) * }) * ``` * --------- * @example * ```typescript * class MyPlugin extends PluginClient { * methods = ['hello'] * hello() { * console.log('Hello World') * } * } * const wss = new WebSocket.Server({ port: 8080 }); * wss.on('connection', (ws) => { * const client = createClient(ws, new MyPlugin()) * }) * ``` */ export declare const createClient:

> = Readonly>(websocket: WS, client?: PluginClient) => Client;