socket和websocket的区别? - Difference between socket and websocket?

问题:

I'm building web app that needs to communicate with another application using socket connections.我正在构建需要使用套接字连接与另一个应用程序通信的 Web 应用程序。 This is new territory for me, so want to be sure that sockets are different than websockets .这对我来说是新领域,所以要确保socketswebsockets不同。 It seems like they're only conceptually similar.似乎它们只是在概念上相似。

Asking because initially I'd planned on using Django as the foundation for my project, but in the SO post I linked to above it's made very clear that websockets aren't possible (or at least not reliable, even with something like django-websockets) using the preferred Django setup (Apache with mod_wsgi).询问是因为最初我计划使用 Django 作为我项目的基础,但在我上面链接的 SO 帖子中,它非常清楚地表明 websockets 是不可能的(或者至少不可靠,即使是像 django-websockets 这样的东西) ) 使用首选的 Django 设置(带有 mod_wsgi 的 Apache)。 Yet I've found other posts that casually import Python's socket module for something as simple as grabbing the server's hostname .然而,我发现其他帖子随意导入 Python 的 socket 模块,就像获取服务器的主机名一样简单。

So:所以:

  • Are they really different?它们真的不同吗?
  • Is there any reason not to use Django for a project that relies on establishing socket connections with an outside server?是否有任何理由不将 Django 用于依赖于与外部服务器建立套接字连接的项目?

解决方案:

参考一: https://stackoom.com/question/Krri
参考二: Difference between socket and websocket?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章