How can I run a WebSocket server on top of Google App Engine? Is it possible? Will it be possible?
To open a websocket connection, we need to create new WebSocket using the special protocol ws in the url: let socket = new WebSocket("ws://javascript.info"); There's also encrypted wss:// protocol. It's like HTTPS for websockets.
js server application to Google App Engine that communicates with a client application via socket.io. Accordingly to this article, websockets are now supported on App Engine.
By definition websockets like normal sockets are client-server so yes, you need a server.
WebSockets applications are supported on Cloud Run with no additional configuration required.
Is it possible?
No.
You can't right now because GAE doesn't allow generic inbound socket connections. Each request is also limited to 30 seconds but this could easily be worked around with automatic reconnection and session tracking.
Will it be possible?
Probably.
Google has been one of the biggest (main) promoters of the WebSockets standard. I would be surprised if they don't push support for it into GAE at some point in the future. Note that the WebSockets draft standard is still in flux so Google might be hesitant to add support before the standard is more solid.
Here is the bug for WebSockets support on GAE: http://code.google.com/p/googleappengine/issues/detail?id=2535
Note that a google employee indicates it's not on the roadmap but that they know it would be useful. That's about as positive an answer as you get from google about features that have not been announced. I recommend adding your voice to that bug in favor of WebSocket support. It can't hurt.
Also, depending on your application, you may consider the Channel API which will likely have GAE support soon:
EDIT (2015): the Channels API is available now (it has been for a while).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With