UNPKG

@eclipse-glsp/vscode-integration

Version:

Glue code to integrate GLSP diagrams in VSCode extensions (extension part)

61 lines 3.07 kB
/// <reference types="node" /> /******************************************************************************** * Copyright (c) 2021-2023 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import { BaseJsonrpcGLSPClient, WebSocketWrapper } from '@eclipse-glsp/protocol'; import * as net from 'net'; import { MessageConnection } from 'vscode-jsonrpc'; import { WebSocket } from 'ws'; import { BaseGlspVscodeServer, GlspVscodeServerOptions } from '../../common/quickstart-components/base-glsp-vscode-server'; export interface SocketGlspVscodeServerOptions extends GlspVscodeServerOptions { /** (Web)socket connection options of the running server. */ readonly connectionOptions: SocketConnectionOptions; } export type SocketConnectionOptions = net.TcpSocketConnectOpts | { /** Address of the server websocket endpoint */ webSocketAddress: string; } | { /** Server websocket port */ port: number; /** Server hostname. Default is 'localhost' */ host?: string; /** Websocket endpoint path*/ path: string; /** The websocket protocol used by the server. Default is 'ws' */ protocol?: 'ws' | 'wss'; }; /** * This component can be used to bootstrap your extension when using the default * GLSP server implementation via (Web)socket connection * * It sets up a JSON-RPC connection to a server running on a specified port and * provides an interface, ready to be used by the `GlspVscodeConnector` for the * GLSP-VSCode integration. * * If you need a component to quickly start your default GLSP server, take a look * at the `GlspServerStarter` quickstart component. */ export declare class SocketGlspVscodeServer extends BaseGlspVscodeServer<BaseJsonrpcGLSPClient> { protected readonly options: SocketGlspVscodeServerOptions; constructor(options: SocketGlspVscodeServerOptions); protected getWebSocketAddress(): string | undefined; createGLSPClient(): Promise<BaseJsonrpcGLSPClient>; protected createConnection(): Promise<MessageConnection>; protected createSocketConnection(opts: net.TcpSocketConnectOpts): MessageConnection; protected createWebSocketConnection(address: string): Promise<MessageConnection>; } export declare function isValidWebSocketAddress(address: string): boolean; export declare function wrapNodeWs(socket: WebSocket): WebSocketWrapper; //# sourceMappingURL=socket-glsp-vscode-server.d.ts.map