Easy WebSocket support with existing TidHTTPServer component :)

Easy WebSocket support with existing TidHTTPServer component :)

TWebSocket turn a idHTTPServer GET request into a WebSocket dialog.

https://github.com/tothpaul/Delphi/tree/master/idWebSocket
https://github.com/tothpaul/Delphi/tree/master/idWebSocket

Comments

  1. Interesting, this is one reason we plan to leave Indy for mormot. Thanks for sharing the code

    ReplyDelete
  2. Roland Bengtsson this one is free, but you still can support my work ;)
    store.execute.fr - Execute's Online Store

    ReplyDelete
  3. Is this based on Andre Mussche's implementation?

    ReplyDelete
  4. Lennart Aasenden I've seen his code, but I did not understand why it was so complicated :)

    I have a WebBroker application and needed a WebSocket connexion...because it is HTTP(S) at first, the code should not be a new server component but an extension to the existing idHTTPServer component.
    After reading the doc, I feeld that it is not that complicate at all :)

    the most complicated part was to not break Indy's logic; for instance, WebSocket replies with a status code 101, and Indy do not send Content for 1xx status code :)

    In fact, idHTTPServer should detect WebSocket requests and raise a OnWebSocket event instead of OnCommandGet

    developer.mozilla.org - Écriture de serveurs WebSocket

    ReplyDelete

Post a Comment