Skip to content

Commit 2074ba9

Browse files
Update index.ts (#63)
Current implementation results in a TS error and doesn't compile or run.
1 parent 907390d commit 2074ba9

File tree

1 file changed

+3
-1
lines changed
  • apollo-server/v4/subscriptions-graphql-ws/src

1 file changed

+3
-1
lines changed

apollo-server/v4/subscriptions-graphql-ws/src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import cors from 'cors';
1313
const PORT = 4000;
1414
const pubsub = new PubSub();
1515

16+
// A number that we'll increment over time to simulate subscription events
17+
let currentNumber = 0;
18+
1619
// Schema definition
1720
const typeDefs = `#graphql
1821
type Query {
@@ -84,7 +87,6 @@ httpServer.listen(PORT, () => {
8487
});
8588

8689
// In the background, increment a number every second and notify subscribers when it changes.
87-
let currentNumber = 0;
8890
function incrementNumber() {
8991
currentNumber++;
9092
pubsub.publish('NUMBER_INCREMENTED', { numberIncremented: currentNumber });

0 commit comments

Comments
 (0)