Introducing WebSockets support for App Engine Flexible Environment
Karolina Netolicka
Product Manager
Do you have an application that could benefit from being able to stream data from the app to the client with minimal latency—without the client having to poll for updates? Today, we are excited to announce that App Engine Flexible Environment now supports the WebSocket protocol in beta—the first time that App Engine supports a streaming protocol. Many users have been looking forward to this feature, as this capability is useful in a number of scenarios, including:
- Real time event updates, such as sports scores, stock market prices, etc.
- User notifications, such as software updates, or content updates
- Chat applications
- Collaborative editing tools
- Multiplayer games
- Feeds, such as social media and news
WebSockets is available to your App Engine Flexible Environment application with no special setup. Take a look at our documentation to learn more: Python | Java | Nodejs.
For clients that don’t support WebSockets, some libraries like socket.io fall back on HTTP long polling. To help you achieve better performance in these cases, we have also added a new “session affinity” setting to app.yaml that allows requests from a single client to be preferentially sent to the same App Engine instance. You should only use session affinity for performance optimization and continue to store application state in a persistent way outside the instance memory since App Engine instances are all periodically restarted.
Our alpha customers are already using WebSockets in production. Shine is a French provider of mobile banking services, and has implemented WebSockets across several parts of its platform.
”We use WebSockets in App Engine Flex to exchange information like banking transactions, user profiles or user metadata between our front-end and back-end. It has worked perfectly for us for several months, was easy to set up and has significantly reduced latency and consumed bandwidth.” - Raphaël Simon, Shine
Support for WebSockets is in beta today and we look forward to making it generally available soon. Check out App Engine and try the new WebSocket protocol today!