Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run a WebSocket server on top of GAE?

How can I run a WebSocket server on top of Google App Engine? Is it possible? Will it be possible?

like image 748
Alon Gubkin Avatar asked Nov 06 '10 19:11

Alon Gubkin


People also ask

How do I run a WebSocket on a server?

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.

Does Google App Engine support 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.

Does WebSocket need a server?

By definition websockets like normal sockets are client-server so yes, you need a server.

Does cloud run support WebSockets?

WebSockets applications are supported on Cloud Run with no additional configuration required.


1 Answers

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:

  • http://googleappengine.blogspot.com/2010/05/app-engine-at-google-io-2010.html
  • http://bitshaq.com/2010/09/01/sneak-peak-gae-channel-api/

EDIT (2015): the Channels API is available now (it has been for a while).

like image 95
kanaka Avatar answered Sep 23 '22 05:09

kanaka