mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Converting server-side Comm.js to typescript
Summary: - Add app/common/CommTypes.ts to define types shared by client and server. - Include @types/ws npm package Test Plan: Intended to have no changes in behavior Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3467
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* open, and what FD they are using.
|
||||
*/
|
||||
|
||||
import {CommDocEventType} from 'app/common/CommTypes';
|
||||
import {arrayRemove} from 'app/common/gutil';
|
||||
import {ActiveDoc} from 'app/server/lib/ActiveDoc';
|
||||
import {Authorizer} from 'app/server/lib/Authorizer';
|
||||
@@ -81,7 +82,7 @@ export class DocClients {
|
||||
* @param {Object} messageData: The data for this type of message.
|
||||
* @param {Object} filterMessage: Optional callback to filter message per client.
|
||||
*/
|
||||
public async broadcastDocMessage(client: Client|null, type: string, messageData: any,
|
||||
public async broadcastDocMessage(client: Client|null, type: CommDocEventType, messageData: any,
|
||||
filterMessage?: (docSession: OptDocSession,
|
||||
messageData: any) => Promise<any>): Promise<void> {
|
||||
const send = (curr: DocSession) => this._send(curr, client, type, messageData, filterMessage);
|
||||
@@ -102,7 +103,7 @@ export class DocClients {
|
||||
/**
|
||||
* Send a message to a single client. See broadcastDocMessage for parameters.
|
||||
*/
|
||||
private async _send(target: DocSession, client: Client|null, type: string, messageData: any,
|
||||
private async _send(target: DocSession, client: Client|null, type: CommDocEventType, messageData: any,
|
||||
filterMessage?: (docSession: OptDocSession,
|
||||
messageData: any) => Promise<any>): Promise<void> {
|
||||
const fromSelf = (target.client === client);
|
||||
|
||||
Reference in New Issue
Block a user