<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 3, 2015 at 7:21 PM, mayamatakeshi <span dir="ltr"><<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hello,</div><div><br></div><div>about module websocket, is it possible to associate a value with the TCP connection and have this value readable when handling SIP requests on that connection?</div></div></blockquote><div><br></div><div>Hello, I have found a way to do it using htable.</div><div>Here is the gist of it in case someone else needs this:</div><div><br></div><div><br></div><div>loadmodule "xhttp.so"</div><div>loadmodule "websocket.so"</div><div><br></div><div>modparam("htable", "htable", "websocket=>size=10")  <br></div><div><br></div><div>route {</div><div>    if(proto == WS) {</div><div>        xlog("L_DEBUG", "WebSocket check: conid=$conid val=$sht(websocket=>$conid)\n");</div><div>    }</div><div>}</div><div><br></div><div>event_route[xhttp:request] {</div><div>    if (ws_handle_handshake()) {</div><div>        # successful connection</div><div><span class="" style="white-space:pre">     </span>#adding $conid to hash table</div><div>        $sht(websocket=>$conid) = $hu; </div><div>        exit;</div><div>     }</div><div>}</div><div><br></div><div>event_route[websocket:closed] {</div><div>    xlog("L_DEBUG", "WebSocket connection from $si:$sp has closed\n");</div><div>    # deleting $conid from hash table</div><div>    $sht(websocket=>$conid) = $null;</div><div>}</div><div> <br><br></div><div>Regards,</div><div>Takeshi</div></div></div></div>