node-fetch#Blob TypeScript Examples

The following examples show how to use node-fetch#Blob. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: client.ts    From skychat with MIT License 6 votes vote down vote up
/**
     * When a message is received on the websocket
     * @param message
     */
    private _onWebSocketMessage(message: any) {
        // If raw audio received
        if (message.data && message.data.constructor === Blob) {
            this.emit('audio', message.data);
            return;
        }
        // Otherwise, if normal json message received
        const data = JSON.parse(message.data);
        const eventName = data.event;
        const eventPayload = data.data;
        this.emit(eventName, eventPayload);
    }