0.0.6 • Published 7 years ago

subscriptions-transport-socketio v0.0.6

Weekly downloads
30
License
-
Repository
github
Last release
7 years ago

subscriptions-transport-socketio

Remake of subscriptions-transport-ws for working with Socket.IO

Client

Constructor(ref)

Methods

subscribe(options, handler) => id

  • options
    • query : GraphQL subscription
    • variables : GraphQL subscription variables
    • operationName : operation name of the subscription
  • handler: (errors, result) => void : function to handle any errors and results from the subscription response

unsubscribe(id) => void

  • id : the subscription ID of the subscription to unsubscribe fro

Server

Constructor(options, ref)

  • options
    • subscriptionManager : GraphQL subscription manager
    • onSubscribe?: (message, params, socket) : optional method to create custom params that will be used when resolving this subscription
  • ref : SocketIO instance

Client-server messages

Each message has a type, as well as associated fields depending on the message type.

Client -> Server

SUBSCRIPTION_START

Client sends this message to start a subscription for a query.

  • query : GraphQL subscription
  • variables : GraphQL subscription variables
  • operationName : operation name of the subscription
  • id : subscription ID

SUBSCRIPTION_END

Client sends this message to end a subscription.

  • id : subscription ID of the subscription to be terminated

Server -> Client

SUBSCRIPTION_SUCCESS

The server sends this message to confirm that it has validated the subscription query and is subscribed to the triggers.

  • id : ID of the subscription that was successfully set up

SUBSCRIPTION_FAIL

Server sends this message upon failing to register a subscription. It may also send this message at any point during the subscription to notify the client the the subscription has been stopped.

  • errors : array of errors attributed to the subscription failing on the server
  • id : subscription ID of the subscription that failed on the server

SUBSCRIPTION_DATA

GraphQL result sent periodically from server to client according to subscription.

  • payload : GraphQL result from running the subscription
  • id : subscription ID
0.0.6

7 years ago

0.0.5

7 years ago

0.0.4-1

7 years ago

0.0.4-0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

1.0.1

7 years ago

1.0.0

8 years ago

0.0.1

8 years ago