Reputation: 1
I'm currently learning about WebSockets and have developed a Spring Boot API that uses the STOMP protocol to support a real-time multiplayer game.
This API connects with Android clients built in Java, where I use the NaikSoftware library for WebSocket handling. During development, I connected to the API locally via localhost to establish the handshake and test my features. Here's the code I used to set up the handshake (hiding my local server IP):
stompClient = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "ws://<LOCAL_SERVER_IP>:8080/ws");
I deployed the API on Google Cloud Platform at the following address: https://mad-grid-api.nn.r.appspot.com
. I attempted to connect using this URL, but the connection was unsuccessful.
stompClient = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "wss://mad-grid-api.nn.r.appspot.com/ws");
I’d appreciate any guidance on how to resolve this issue.
To investigate further, I attempted to connect to this address via WebSocket using Postman, I received the following error:
Error: Unexpected server response: 400
Handshake Details
Request URL: https://mad-grid-api.nn.r.appspot.com/ws
Request Method: GET
Status Code: 400 Bad Request
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: VFMwgubuvtSFrpBQjZV+Hw==
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: mad-grid-api.nn.r.appspot.com
Response Headers
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer
Content-Length: 273
Date: Tue, 29 Oct 2024 19:36:13 GMT
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Connection: close
Upvotes: 0
Views: 23