Closed rrifafauzikomara closed 1 year ago
I did not check the code but do you try to use the correct ws protocol? Check the ws link dart docs about the protocol name
I copy the ws link from console log (IDE) when I running that code, then paste it to Postman, it's success connected. Then I send the Message
by clicked Send
button, it's success get the data as well.
Seems the problem is I need to send the Message
as well like in the Postman, but not sure how to do it on ur pacakge, any suggestion?
For the ws protocol, yea i use the correct one, which is 'Sec-WebSocket-Protocol': GraphQLProtocol.graphqlWs,
same like in the Postman, which is Sec-WebSocket-Protocol:graphql-ws
I am not able to see what is the ws server protocol, can you post it?
In addition, I am having a hard time with the postman image because I do not use it, so with postman you are able to get the result in the correct way? If yes we need a reproducer for this
how i can get/see the ws server protocol
? I do not understand what u mean, basically, I just follow ur example from here: https://github.com/zino-hofmann/graphql-flutter/tree/main/examples/starwars
but adding some extra code like header, token, etc. I already share all my code above.
Yea from the postman I can get the data because I can send the Message
by clicked the Send
button, but how to do it in ur package?
The demo is not working, so you should follow this https://github.com/zino-hofmann/graphql-flutter/pull/1204 I should merge it, too also, if needs some work.
In addition, you should know what protocol the server speaks, I can not know. Try to change the protocol to the last one and see what happens
Yea from the postman I can get the data because I can send the Message by clicked the Send button, but how to do it in ur package?
Sorry I do not know what Send a message means!
in my example code above, I already share the ws protocol
, which is graphql-ws
.
Sorry I do not know what Send a message means!
How can u understand it if u never see my Postman image, lol.
Here's the image, pls see the red line!
No please no screenshot, try to change the protocol with the second one and see the server has the new protocol enabled
So you hope to understand other developer's problems that use ur package without wanting to see the problem? lol
Change protocol to what? in postman, we use that on the header. In my example code above, I use it as well. And for the ws link we use the same for both flutter code and also postman.
ws link: wss://BASEURL/graphql/realtime?header=<EncodedHeader>&payload=e30=
ws protocol: graphql-ws
So you hope to understand other developer's problems that use ur package without wanting to see the problem? lol
You are asking to me to spend time on your problem without know what ws protocol your server speak, by putting a couple of picture together and without know that the library support another protocol (and this mean that you never see the docs) https://github.com/zino-hofmann/graphql-flutter/blob/71d7502dec9336fa72d60d44780294ba01fde7ae/packages/graphql/lib/src/links/websocket_link/websocket_client.dart#L175
every time I regret spending some time on an issue without reproducer. So if you want me to see the problem you need to reproduce an issue with an example that I can run.
P.S: It is missing also the library version, so this is not a bug report, but a consultancy request it you want it you should consider using the email.
Cheers
Sorry about that, prev I don't understand what ws
meant, but if u see my code and also I already share it with u right, the ws protocol
u mean was graphql-ws
or GraphQLProtocol.graphqlWs
.
by putting a couple of picture together
Like I said before right, the subscription working on Postman, then I want to explain it to u so I put a couple of pictures together with some description about that pictures, but u say Sorry I do not know what Send a message means!
:(. Then how I can explaint the Postman and my case to u? coz the Message
and Send
what I mean before is only available on the screenshot :(.
But yeah nvm, thanks for spending ur time to take a look on my issue. The problem before it's not because ws protocol
i think, but because I don't add connectFn
in the WebSocketLink
. After I add this, now I can get the data from subs. But seems got another error from that.
flutter: Rifa 3: {"type":"connection_ack","payload":{"connectionTimeoutMs":300000}}
flutter: Rifa 3: {"type":"ka"}
flutter: Rifa 3: {"type":"error","payload":{"errors":[{"errorType":"UnsupportedOperation","message":"unknown not supported through the realtime channel"}]}}
Is this error coming from my server or from the package (need more setup)?
Just checking the error on stack overflow https://stackoverflow.com/questions/74293606/websocket-with-appsync-error-unsupportedoperation-unknown-not-supported-throug
It is the server, please see the PR that are open to check how to do authentication
I am closing this because you solved the problem by looking at your code. feel free to if you had a reproducer
I am creating a subscription with GraphQL, and I need to consume that subscription with Flutter, but I don't know how to do that on the Flutter side. But I can understand doing that on Postman.
Here are the steps to test a subscription on Postman:
Message
by clickingSend
button.And here's the result for above steps.
And if I do these steps, the subscription will not work.
And here's the result for above steps.
As u can see, even though connected to the wss, if i dont send the
Message
by clicked theSend
button, the subscription will not work.When I try to implement the subscription in Flutter side, seems only connected to the wss, here's the result.
So my question is, how to send the
Message
like from Postman but in Flutter side?Here's the
Message
data.Here's the
Schema
from AWS.And here's my Flutter code to impl the subscription.