无服务器互联网聊天客户端?
有谁知道无服务器聊天客户端背后的逻辑,该客户端能够不是局域网范围内但互联网范围内互连?它不需要能够检测到世界各地的其他用户,它只需要获得某种唯一标识即可连接到用户,例如 IP 或某种唯一 ID。
Does anyone know of the logic behind a server-less chat client that would be able to interconnect not LAN-wide but internet-wide? It doesn't need to be able to detect other users world wide, it just needs to obtain some kind of unique identification to be able to connect to a user, like an IP or a unique ID of some sort.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要从某处获取一些信息。你不能在不知道每个人在哪里的情况下打开它并开始聊天。您可能有一个始终在线的节点,并且知道一些其他节点。其他节点会知道其他节点,而那些节点会知道更多,等等。是否将该静态节点称为“服务器”是有争议的。它可能只是您朋友的节点,或者是公开可用的 IP。一旦启动并运行,您将不再需要启动节点。
在这种类型的系统中,如果您想要除 IP 地址之外的某种标识,则需要询问您的邻居。 IP 地址也有其自身的缺点,因为家庭 DSL 连接的路由器后面可能有两个人。唯一 ID 需要在整个网格中进行递归查询,以确定您的 ID 是否唯一。
在这种类型的系统中,您只需要知道有限的人子集就可以与任何人聊天,因为您可以查询周围的每个人(并且查询会递归发生)以获取该人的位置。对存储在本地节点上的人数的人为限制可以通过最近最少使用算法来实现,有点像 CPU 缓存。
To start, you need some information from somewhere. You can't just turn it on and start chatting without knowing where everyone is. You might have one node that is online all the time and knows a few other nodes. The other nodes would know other nodes and those would know more, etc. It is debatable whether or not you would call that static node a "server" or not. It could just be your friend's node, or a publicly available IP. Once you are up and running, you wont need the start node anymore.
In this type of system, you would need to query your neighbors if you want some sort of identification besides IP address. An IP address has its own drawbacks as well, because you might have two people behind a router at a home DSL connection. Unique ID's would require a recursive query across the whole mesh to find out if your ID is unique.
In this type of system, you would only need to know a limited subset of people in order to chat with anyone, as you can query everyone around you (and the query happens recursively) for the location of that person. An artificial limit on the number of people stored on the local node might be implemented with a Least Recently Used algorithm, kind of like a CPU cache.