Hi, you could use another GAE service with maximum scaling = 1, which would act as a proxy to Discord for a new GAE bot service, which would continue scaling as before. The proxy service would just take the connection functionality from the old bot service and modify it minimally to forward the connections from the new bot service to discord using just one socket, and it shouldn't have much of an issue with workload even if the number of requests is considerable, as it is just relaying the information. The new bot service would have the connectivity logic adapted to this new setting.
You could also use a GCE instance instead of a GAE service for the proxy. Best regards On Tuesday, 22 September 2020 at 16:52:49 UTC+2 ledu...@gmail.com wrote: > Hi, > > I'm using AppEngine Flexible for a Discord bot. The application needs to > keep one Web Socket connection to Discord Web Socket server. So, when the > application starts, it opens a Web Socket connection and keep connected > with Discord Web Socket server. > > When the application is scaling up and running multiple instances at the > same time, it also establish multiple Web Socket connections to Discord Web > Socket server. In the result, the bot receive same events on multiple > instances and replies multiple identical messages. > > How can I make sure that the bot establish only one Web Socket connection > to Discord Web Socket server? > > Best, > Bao > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/110725a8-b6c4-4a9a-83f3-12b206eb0f1bn%40googlegroups.com.