format import { ClientResponseType , GetBackgroundPluginsMessage , GetPluginsMessage , } from 'flipper-common' ; import WebSocket from 'ws' ; import WebSocketClientConnection from './WebSocketClientConnection' ; deprecated export class BrowserClientConnection extends WebSocketClientConnection { public legacyFormat = false ; private static isGetPluginsCall ( data ) { return ( data as GetPluginsMessage ) . method === 'getPlugins' ; } private static isGetBackgroundPluginsCall ( data ) { return ( ( data as GetBackgroundPluginsMessage ) . method === 'getBackgroundPlugins' ) ; } constructor ( ws , public plugins ? ) { super ( ws ) ; } async sendExpectResponse ( data ) { if ( BrowserClientConnection . isGetPluginsCall ( data ) && this . plugins ) { return { success : { plugins : this . plugins } , length : 0 , } ; } if ( BrowserClientConnection . isGetBackgroundPluginsCall ( data ) && this . plugins ) { return { success : { plugins : [ ] } , length : 0 , } ; } return super . sendExpectResponse ( data ) ; } protected serializeData ( data ) { return super . serializeData ( this . legacyFormat ? { payload : data } : data ) ; } }