Comments (13)
import { SubscriptionServer } from 'subscriptions-transport-ws'
import { execute, subscribe } from 'graphql'
var httpSrv = fastify.listen(3002, err => {
if (err) throw err;
console.log('Server listenting on localhost:', fastify.server.address().port);
});
const graphSrv = new SubscriptionServer(
{
execute,
subscribe,
schemaGraph
},
{
server: httpSrv,
path: '/graphql'
}
)
I have some schema issues, but that'S the code I have right now. Hope it works.
from fastify-graphql.
I fix it by changing httpServer
to fastify.server
it's not error but Subscription doesn't work. Why?
from fastify-graphql.
Apologies for not seeing this sooner! Thank you @Extarys for your example, I might document this in the README.
from fastify-graphql.
Thank you sir
from fastify-graphql.
Thank you sir
from fastify-graphql.
I had to change schemaGraph
to schema: schemaGraph
though (I forgot to change it in my first reply), hope you figured it out! 😄
from fastify-graphql.
No problem, my pleasure
from fastify-graphql.
it doesn't work . I don't know what are the problems
from fastify-graphql.
I'm not sure that [object object]
is error or not ?
from fastify-graphql.
https://github.com/n3ologism/music-fastify/tree/backend/backend/src
This is my repository
from fastify-graphql.
@lagmanzaza tnx, its work for me fastify.server
import { execute, subscribe } from 'graphql'
import { SubscriptionServer } from 'subscriptions-transport-ws';
import { schema } from "./api/schema"
const fastify = require('fastify')({
logger: false
})
// This `listen` method launches a web-server
fastify.listen(3000, (err, address) => {
if (err) throw err
console.log('\x1b[35m', `🚀 Server ready at http://localhost:3000/graphql`)
console.log("\x1b[35m", `🚀 Subscription server ws://localhost:3000/graphql`)
})
new SubscriptionServer(
{
schema,
execute,
subscribe,
},
{
server: fastify.server,
path: '/graphql',
},
);
from fastify-graphql.
@nikitamarcius Actually, You can use Apollo server instead
from fastify-graphql.
@lagmanzaza nope. Tried first, HTTP endpont works, but subscriptions no handshake error
. Test with Koa and Fastify. Works only with HTTP native module
Better Graphql + Fastify + subscriptions.
from fastify-graphql.
Related Issues (11)
- How to add authentication to graphql? HOT 4
- Error: `Promise may not be fulfilled with 'undefined' when statusCode is not 204`
- New release HOT 3
- dataSources is not working
- cors problems HOT 1
- No response headers? No Cookies? HOT 1
- Determine whether or not we should squash the 11 commits we made fixing Travis HOT 1
- GraphQL responses are serialized twice HOT 1
- Move to apollo-server repository HOT 6
- GraphQL version HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify-graphql.