Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can google app engine be used as a socket server?

My webhost has rules against socket servers so I've been looking into GAE.

Does anyone know of a socket server that can successfully run on GAE? I'm using it for flash so anything like smartfox would be amazing if it's possible.

Thanks.

like image 867
N S Avatar asked Feb 13 '10 06:02

N S


People also ask

Does App Engine support WebSockets?

You can use WebSockets to create a persistent connection from a client (such as a mobile device or a computer) to an App Engine instance. The open connection allows two-way data exchange between the client and the server at any time, resulting in lower latency and better use of resources.

Does Google use WebSockets?

Google does not support WebSocket connections in Googlebot. This was first known, I think, back in May 2019, when Martin Splitt and Zoe Clifford presented at Google I/O.

Is App Engine a server?

App Engine is a fully managed, serverless platform for developing and hosting web applications at scale. You can choose from several popular languages, libraries, and frameworks to develop your apps, and then let App Engine take care of provisioning servers and scaling your app instances based on demand.


3 Answers

Google App Engine has Channel API now

The Channel API creates a persistent connection between your application and Google servers, allowing your application to send messages to JavaScript clients in real time without the use of polling. This is useful for applications designed to update users about new information immediately. Some example use-cases include collaborative applications, multi-player games, or chat rooms. In general, using the Channel API is a better choice than polling in situations where updates can't be predicted or scripted, such as when relaying information between human users or from events not generated systematically. - taken from the link below

http://code.google.com/appengine/docs/python/channel/overview.html

Update: October 27, 2016

Channels API has been deprecated and scheduled to be turned down by 31st October, 2017

https://cloud.google.com/appengine/docs/deprecations/channel

Alternative products

You can use the Firebase Realtime Database to achieve superior realtime functionality in your application. Firebase is a more robust and customizable solution than the Channels API, and it allows communication with a broader set of clients. It currently supports Android, iOS, and apps, and web browser apps.

like image 141
alvinsj Avatar answered Sep 26 '22 06:09

alvinsj


Sockets are not supported on GAE. More supported/not supported infp here:

http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1

like image 32
Cody Caughlan Avatar answered Sep 23 '22 06:09

Cody Caughlan


I can confirm that i have a multiplayer game using canvas/GWT/App Engine up and running using the channels api. Im using the memcache to hold the current state and have the clients report in to the server with their current state, the server will then broadcast the new state to all clients if a certain time has passed ( to keep it from sending to often if you have a high number of users ). This approach seems to take up a bunch of cpu power however, currently my approach is to have a bare minimum of logic on the server, wich means there are a lot of openings for hacks etc.. The multiplayer interaction needs some work but i have players moving within aprox a half of a seconds delay on other clients, thats also because im not showing the last known posiiton directly, im interpolating between the old position and the last known. If anyone has a better approach on how to do it on google app engine instead of using the memcache please let me know.

like image 23
djdolber Avatar answered Sep 23 '22 06:09

djdolber