How to use subscriptions-transport-ws-hally9k - 1 common examples

To help you get started, we’ve selected a few subscriptions-transport-ws-hally9k examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hally9k / redux-graphql-subscriptions / src / index.js View on Github external
return (next: *): * => (action: *): * => {
            const { type }: * = action

            if (type === CONNECT && !wsClient) {
                const {
                    options,
                    handlers,
                    url,
                    protocols,
                    disconnectionTimeout = 0
                }: ConnectionPayload = (action.payload: any)

                wsClient = new SubscriptionClient(url, options, null, protocols)

                handlerMap.onConnected = wsClient.onConnected(() => {
                    dispatchQueuedActions()
                    if (
                        handlers &&
                        typeof handlers.onConnected === 'function'
                    ) {
                        dispatch(handlers.onConnected())
                    }
                })
                if (handlers) {
                    if (typeof handlers.onConnecting === 'function') {
                        handlerMap.onConnecting = wsClient.onConnecting(
                            (): * => {
                                if (disconnectionTimeoutId) {
                                    clearTimeout(disconnectionTimeoutId)

subscriptions-transport-ws-hally9k

A websocket transport for GraphQL subscriptions

MIT
Latest version published 5 years ago

Package Health Score

51 / 100
Full package analysis

Popular subscriptions-transport-ws-hally9k functions

Similar packages