Skip to content

Experimental transport implmentation for GraphQL dotnet server 5.0.2+, with graphql-sse as client.

License

Notifications You must be signed in to change notification settings

fallenwood/GraphQL.Server.Transports.ServerSentEvents

Repository files navigation

GraphQL.Server.Transports.ServerSentEvents

Introduction

Experimental transport implmentation for GraphQL dotnet server 5.0.2+, with graphql-sse as client.

How to run example

  1. Make sure dotnet 6 and nodejs are installed
  2. Inside GraphQL.Server.Transports.ServerSentEvents.Samples/ClientApp, run npm install, npm run build
  3. Inside GraphQL.Server.Transports.ServerSentEvents.Samples, run dotnet run
  4. Visit http://loccalhost:5000/index.html, click subscribe button
  5. With some http client like postman, send a GraphQL mutation like
// Query
mutation AddMessage($message: MessageInputType!) {
  addMessage(message: $message) {
    from {
      id
      displayName
    }
    content
  }
}

// Variables
{
  "message": {
    "content": "Message",
    "fromId": "1"
  }
}

Note: The subscription query is

subscription MessageAdded {
  messageAdded {
    from { id displayName }
    content
  }
}

TODOs

  • Fix single connection
  • Unit tests
  • Github actions
  • Test with more cases
  • Beautify example
  • Publish to Nuget

License

MIT

About

Experimental transport implmentation for GraphQL dotnet server 5.0.2+, with graphql-sse as client.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published