建筑使用Amazon EC2聊天服务器服务器、建筑、Amazon

2023-09-11 09:21:43 作者:落在眼里的最后一滴雨`

我的工作建设用简单的套接字的聊天服务器。我想知道是否可以使用Python套接字服务器库和Amazon EC2实例创建一个基本的聊天服务器。此外,如果您有什么更好的建议,请让我知道。

I am working on building a chat server using simple sockets. I was wondering if it is possible to use the python socket server library and an amazon ec2 instance to create a basic chat server. Also, if you have any better recommendations please let me know.

推荐答案

您可以方便的服务器到服务器上使用套接字亚马逊EC2服务器进行通信。根据您如何打开插座,您可能需要配置您的EC2实例监听的传入连接在某些端口;看this文章如何修改服务器的安全设置,以允许入站连接的更多细节。

You can facilitate server-to-server communication on Amazon EC2 servers using sockets. Depending on how you open the sockets, you may need to configure your EC2 instances to listen for incoming connections on certain ports; see this article for more details on how to modify your server's security settings to allow inbound connections.

至于替代的建议,我会建议使用实时网络如PubNub你的聊天客户端和服务器之间传递数据。使用实时网络意味着你可以花更少的时间去担心低级别的插座问题,如并发性和更多的时间构建应用程序。

As far as alternate recommendations, I would recommend using a real-time network such as PubNub to relay data between your chat clients and the server. Using a real-time network means that you can spend less time worrying about low-level socket issues such as concurrency and more time building your application.

在PubNub,一个的情况下的的Python SDK 将让您的服务器订阅聊天频道,而 的JavaScript SDK 可以适用于任何基于Web的更好客户端。

In the case of PubNub, a Python SDK will allow your server to subscribe to chat channels, while the JavaScript SDK may work better for any web-based clients.

看看这个例子:创建实时聊天应用程序在code 10行。我相信这种方式会为您的方案,同时让你的服务器订阅相同的聊天频道登录聊天消息。

Check out this example: Build Real-Time Chat Apps in 10 Lines of Code. I believe this approach would work for your scenario, while allowing your server to subscribe to the same chat channels to log the chat messages.

让我知道这对你的作品。祝你好运!

Let me know if this works for you. Good luck!

 
精彩推荐