We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Proper way for IIS8 nativemodule to close Websocket in C++?RSS

2 replies

Last post Apr 17, 2019 12:43 PM by svandex

  • Proper way for IIS8 nativemodule to close Websocket in C++?

    Apr 22, 2014 09:25 AM|garykibble|LINK

    I've figured out websocket multi-fragment read/write with a C++ nativemodule but it's not clear to me the "correct" way for the server to end a socket session. Also which server-side functions below are necessary if the client closes the websocket?

    The IWebSocketContext interface has three functions for websocket closure:




    Should all three be used? In what order? 

    websocket module iis8 native

  • Re: Proper way for IIS8 nativemodule to close Websocket in C++?

    Apr 30, 2014 04:38 AM|lextm|LINK

    If you read MSDN documentation carefully along with WebSocket RFC,



    You will see that CloseTcpConnection is exactly _Close the WebSocket Connection_ in RFC6455 7.1.1, while SendConnectionClose is 7.1.2. Disgesting the RFC document further and you will tell what's the differences and when to use which. 

    CancelOutstandingIO is not related to connection close both by name and its explanation on MSDN.

    websocket module iis8 native

    Lex Li
    Want to have a chat on the issues you meet? Find me at https://booktime.xyz/p/lextm
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Proper way for IIS8 nativemodule to close Websocket in C++?

    Apr 17, 2019 12:43 PM|svandex|LINK

    Hi, garykibble

    I followed steps in this link: https://blogs.iis.net/jennylaw/iis-and-websockets

    and I have got the IWebSocketContext pointer, but when i call ReadFragment/WriteFragment, the HRESULT is E_NOTIMPL, that means the two functions are not implemented. why happend that? do i have to set module context or do i have to do others steps before I call ReadFragment/WriteFragement?

    I write my code in OnEndRequest function. And I don't know how to make things work while i write my code in OnExcecuteRequestHandler, give me some examples?

    Hope you can help me, thanks.