graphql.js icon indicating copy to clipboard operation
graphql.js copied to clipboard

Better Subscription

Open f opened this issue 8 years ago • 10 comments

Subscriptions need to be implemented.

They can be that easy:

var onCommentsAdded = graph.subscribe`{ commendAdded { user {name}, text } }`

onCommentsAdded(function (data) {
  console.log(data.user.name)
})

And can be unsubscribed.

var onCommentsAdded = graph.subscribe`{ commendAdded { user {name}, text } }`

onCommentsAdded.unsubscribe()

f avatar Feb 19 '17 17:02 f

EventSource is the best model to be updated by subscriptions.

f avatar Feb 20 '17 06:02 f

do subscriptions work without sockets? never saw anything about web socket connections. are subscriptions working now?

emahuni avatar Aug 01 '19 19:08 emahuni

Are subscriptions implemented at all? Though I see some helper methods in the documentation and source code I can't seem to get them to work...

corstian avatar Sep 09 '19 09:09 corstian

Cant find how subscriptions can work ..... someone has a sample ?

hedevelop avatar Nov 03 '19 17:11 hedevelop

@hedevelop Subscriptions are not implemented. Personally I switched to the Apollo stack in order to be able to consume subscriptions.

corstian avatar Nov 04 '19 08:11 corstian

Is this thing abandoned?

I like the library but the lack of subscriptions is a problem. Hasura uses websockets which seem pretty easy to implement. The lib is simple enough that I could probably hack a solution together if anyone is still interested.

Do I need to hard fork the thing?

frink avatar Feb 09 '21 04:02 frink

@frink I do not really know how subscriptions work but if you're interested in improving it I really want to see your PR and want to add you as a contributor! Can you simply implement?

f avatar Feb 09 '21 11:02 f