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?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章