|
OnConnect连接成功 | 整数型 | | |
pSender | 整数型 | | | | dwConnID | 整数型 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | szAddress | 文本型 | | | iAddressLen | 整数型 | | | usPort | 整数型 | | | 返回值 | 整数型 | | | 如果真 (全_ssl = 假) SendUpgrade (pSender, dwConnID )返回 (0)|
OnHandShake握手 | 整数型 | | |
pSender | 整数型 | | | | dwConnID | 整数型 | | | | SendUpgrade (pSender, dwConnID )返回 (0 ) |
OnUpgrade升级协议 | 整数型 | | |
pSender | 整数型 | | | | dwConnID | 整数型 | | | | enUpgradeType | 整数型 | | | |
.  判断 (enUpgradeType = #HUT_WEB_SOCKET ) 如果 (全局_连接成功 < 1 ) 返回 (0 )  调用子程序 (全局_连接成功, , 返回值, dwConnID ) 返回 (返回值 ) 返回 (0)
返回 ( #HR_ERROR )
首先你的代码有几处不对(好久没写hp了,下面1,2可能不对,我也记不清非SSL的连接会不会触发OnHandShake)
1. 连接成功事件应该是ws连接成功(OnUpgrade)之后通知,而不是在tcp连接成功(OnConnect)就通知
2. OnHandShake应该是ssl才会触发,如果没有ssl就应该立即发送SendUpgrade,否则就在OnHandShake发送SendUpgrade
3. 模块没有处理deflate压缩数据,所以就没必要发送headers里面的 Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
|