jarhf / JarhfStomp4Net

A stomp client and sockjs client implementation for C#
MIT License
13 stars 2 forks source link

有關JarhfStomp4Net 使用 #1

Open Elliot9 opened 7 years ago

Elliot9 commented 7 years ago

你好 , 我正需要這個 websocket Server端是由 sockjs跟stomp-client 組合 而我打算 使用 C# winsform 完成client端 請問我該怎麼著手? 有沒有什麼方向 或是 範本 謝謝

jarhf commented 7 years ago

@Elliot9 我这个代码就是C# WinForm客户端。 通信协议是sockjs规范, 内容协议是stomp ,我的server端是spring websocket. 客户端StompClient用法很简单, readme中有订阅消息的示例代码, 还有一个常用的方法就是发送消息。

fkahhaleh commented 7 years ago

Websocket4Net is broken with Spring websocket server (stomp implementation). It is not the JarhfStomp4Net project that is not working, but the usage of Websocket4Net is the problem. (two other projects have the same issue cause they use the above mentioned websocket library)

I have implemented websocketSharp in JarhfStomp4Net and it works perfect with Spring Websocket.

jarhf commented 7 years ago

@fkahhaleh Because Spring Websocket server using SockJs protocol, the message body start with 'a','m' or 'c' , well the Websocket4Net don't know

fkahhaleh commented 7 years ago

@jarhf , it makes sense now. (I was planning to look at the sourcecode to understand why, thanks for saving me the trouble)

Question, does this make Websocket4Net not 100% compatible/standard with WebSocket protocols? or is Spring/SockJS the one not standard?

Thanks

jarhf commented 7 years ago

@fkahhaleh WebSocket is lower protocol, SockJs is over on WebSocket, it implement text message communication. Look at the SockJsClient I had translated from sock.js (javascript) into C# using Websocket4Net.dll

fkahhaleh commented 7 years ago

@jarhf , Yes you are right. That is why I decided to work on the code to allow the user to choose or extend with relative ease the WebSocket implementation to use. Certain libraries are better than others I think in some cases.

Thanks