0

did anyone use WebSocket connections between a Flutter/Dart client and a server running on Google Cloud Run successfully?

Exactly this combination fails for me.

The client works with the same server on localhost.
Another client works with the same server on Cloud Run.

I tried to find the cause of the problem, so I have created a complete bug reproducer with clients in Dart and Python and servers in Java and Python:

The Dart client works with WebSocket echo server running on localhost:

> dart run wsclient.dart --url ws://localhost:8080/websocket

2021-02-26 21:25:22.293451 Starting connection attempt to ws://localhost:8080/websocket ...
2021-02-26 21:25:22.418794 WebSocket readyState: 1
2021-02-26 21:25:23.446877 Sending 'hello'
2021-02-26 21:25:23.458083 Received data: echo of hello
2021-02-26 21:25:24.422013 Sending 'how are you?'
2021-02-26 21:25:24.422752 Received data: echo of how are you
2021-02-26 21:25:26.433450 Sending 'still there?'
2021-02-26 21:25:26.436280 Received data: echo of still there?
^C
^C

The Dart client does NOT work with WebSocket echo server running on Google Cloud Run — the WebSocket is closed right after the Dart client sends data:

> dart run wsclient.dart --url wss://websocket-echo-server-quarkus-xxxxxxxxxx-xx.x.run.app/websocket

2021-02-26 21:25:40.539316 Starting connection attempt to wss://websocket-echo-server-quarkus-xxxxxxxxxx-xx.x.run.app/websocket ...
2021-02-26 21:25:40.844298 WebSocket readyState: 1
2021-02-26 21:25:41.851590 Sending 'hello'
2021-02-26 21:25:41.898587 CONNECTION DONE!
readyState=3
closeCode=1005
closeReason=

2021-02-26 21:25:42.847345 Sending 'how are you?'
2021-02-26 21:25:44.848959 Sending 'still there?'

Do you have any idea how this can happen? Did I do anything wrong in my code?

Thank you very much

Thomas

Thomas
  • 1
  • 1
  • Start by creating an example that shows the problem and the errors. Your question has not details that can help solve your problem. https://stackoverflow.com/help/minimal-reproducible-example – John Hanley Feb 27 '21 at 01:29
  • @JohnHanley: Did you see the links to my three GitHub repositories containing detailed reproducible examples? – Thomas Feb 27 '21 at 10:56
  • Your question must be self contained and not require going to off-site resources. Links break, are deleted, etc. possibly rendering your question useless in the future. https://stackoverflow.com/help/how-to-ask – John Hanley Feb 27 '21 at 18:39

0 Answers0