Can't connect to backend API through WebSockets #14878
-
I have a tool for integration testing my Theia backend extensions. However, when I use any websockets tool, I get "error: socket hang up". Did some investigating and it appears that Theia is refusing connections (not upgrading to websockets) from non-Theia clients. Running Theia frontend to test the backend doesn't fit with my integration testing. What do I need to get this working? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @daleasberry-n, the Theia frontend does not use plain websocket connections to communicate to the backend. In fact, you will probably find it to be very difficult to create any meaningful connection with Theia's backend given that we use socket.io + messagepack + a custom RPC mechanism to form the connection and send messages. Theia's backend server infrastructure is not built with API integration testing in mind. In theory you can probably get this to work by reusing parts of the frontend stack, but I'm not entirely sure how easy it is to set this up. My recommendation would be to either test your code directly via |
Beta Was this translation helpful? Give feedback.
Hey @daleasberry-n,
the Theia frontend does not use plain websocket connections to communicate to the backend. In fact, you will probably find it to be very difficult to create any meaningful connection with Theia's backend given that we use socket.io + messagepack + a custom RPC mechanism to form the connection and send messages. Theia's backend server infrastructure is not built with API integration testing in mind. In theory you can probably get this to work by reusing parts of the frontend stack, but I'm not entirely sure how easy it is to set this up.
My recommendation would be to either test your code directly via
jest
or similar testing frameworks or use the@theia/playwright
packa…