44
55import { randomBytes } from 'crypto' ;
66import { inject , injectable } from 'inversify' ;
7- import WebSocket from 'ws' ;
7+ import WebSocket , { type RawData , type WebSocketServer } from 'ws' ;
88import { Cdp } from '../cdp/api' ;
99import { ICdpApi , ProtocolError } from '../cdp/connection' ;
1010import { CdpProtocol } from '../cdp/protocol' ;
@@ -162,7 +162,7 @@ export const ICdpProxyProvider = Symbol('ICdpProxyProvider');
162162 */
163163@injectable ( )
164164export class CdpProxyProvider implements ICdpProxyProvider {
165- private server ?: Promise < { server : WebSocket . Server ; path : string } > ;
165+ private server ?: Promise < { server : WebSocketServer ; path : string } > ;
166166 private readonly disposables = new DisposableList ( ) ;
167167 private readonly replay = new DomainReplays ( ) ;
168168
@@ -241,7 +241,7 @@ export class CdpProxyProvider implements ICdpProxyProvider {
241241
242242 this . logger . info ( LogTag . ProxyActivity , 'activated cdp proxy' ) ;
243243
244- server . on ( 'connection' , client => {
244+ server . on ( 'connection' , ( client : WebSocket ) => {
245245 const clientHandle = new ClientHandle ( client , this . logger ) ;
246246 this . logger . info ( LogTag . ProxyActivity , 'accepted proxy connection' , {
247247 id : clientHandle . id ,
@@ -254,7 +254,7 @@ export class CdpProxyProvider implements ICdpProxyProvider {
254254 this . disposables . disposeObject ( clientHandle ) ;
255255 } ) ;
256256
257- client . on ( 'message' , async d => {
257+ client . on ( 'message' , async ( d : RawData ) => {
258258 let message : CdpProtocol . ICommand ;
259259 try {
260260 message = JSON . parse ( d . toString ( ) ) ;
0 commit comments