Download spectrum/api/routes/create-subscription-server.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 541 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/routes/create-subscription-server.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/api/routes/create-subscription-server.js
-
curl -L -o create-subscription-server.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/routes/create-subscription-server.js
541 Bytes
| // @flow | |
| import { SubscriptionServer } from 'subscriptions-transport-ws'; | |
| import { execute, subscribe } from 'graphql'; | |
| import schema from '../schema'; | |
| /** | |
| * Create a subscription server based on an exisiting express.js server | |
| */ | |
| const createSubscriptionsServer = (server: any, path: string) => { | |
| // Start subscriptions server | |
| return SubscriptionServer.create( | |
| { | |
| execute, | |
| subscribe, | |
| schema, | |
| keepAlive: 10000, | |
| }, | |
| { | |
| server, | |
| path, | |
| } | |
| ); | |
| }; | |
| export default createSubscriptionsServer; | |