Closed ZeAleks closed 8 years ago
OK I found something. I noticed that, when running my test without breakpoints, I didn't get any exceptions.
Digging a little more, I subscribed to the FrameReceived event. Here, I'm getting a Control Frame Close right after the OpenAsync call.
Why did I receive a Close frame ? What does it meen ? I'm using OpenShift for my websocket server and within a html/javascript client everything is working fine.
Any help will be appreciated.
Thank you. Alek
Hey, thanks for digging.
What platforms are you testing on ?
My pleasure Nicholas,
So, the platforms I m testing on is OpenShift. I tried 2 other platforms and here are the results:
1.InnerInvoke() à System.Threading.Tasks.Task.Execute() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à WebSocket.Portable.WebSocketBase.<SendHandshakeAsync>d__13.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à WebSocket.Portable.WebSocketClientBase
1.(Sorry, exceptions are in french. Didn't how to change that.)
What client platforms ?
Oh OK. I m on visual studio 2015. The common project is the default pcl for win phone, xamarin, ios, etc And for now I m using the default ms unit test to test this common project.
Alek
https://github.com/NVentimiglia/Websockets.Pcl
Please try this out. It has limited testing, but it is a radically simpler plugin.
OK I made some advance today. I'm new in WebSockets world so It takes me some time to understand where to look to understand what was going wrong. In fact, I'm using socket.io package on my node.js. It has some custom URL schema. When connecting, I have to add /socket.io/?EIO=3&transport=websocket to the connection string.
But, where I have still a problem, it is that the server is giving a custom sid after the connection that I have to add to the URL. The connection string become something like /socket.io/?EIO=3&transport=websocket&sid=taHsBUhrpz-D04ciAAAC
I didn't found anything in your library to add this sid after the connection.
Did you ever use socket.io ? Is there a way to add this sid ?
No to both. At first glance these look like uri paramaters. Cant you just append them to the socket url ?
I have to make a first connection to get this sid. Then, I do not have anymore access to the URL as it is only "accessible" on OpenAsync method. If I try to use it on another WebSocket, the server immediately close the socket.
Maybe that respects to the implementation details of socket.io would be a better fit, have you tried :
Yes I did but I can't add it to my PCL project : Could not install package 'SocketIoClientDotNet 0.9.13'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework
Take a look at my new websocket project (above). How I get around the problem is I have a very light weight PCL library (an interface and static factory). Then I have my slightly heavier platform implementations. You could try the same strategy. Include the SocketIO in the Android / Ios projects, and then have an interface to get the correct platform implementation from within your PCL.
I will certainly end up to do that. But I was hopping to have something less intrusive (just a nuget package). What is the websocket library you are using for your tests ?
Serverside I try to use C# (MVC Apps). That said, I mostly test against the Realtime Framework, as I do allot of front end POCs.
OK. Full Microsoft stack. I used to do the same but, after investigating on node.js, I found it much more lighter thant MVC, SignalR, etc. for some easy cases without a lot of business.
Moreover, it is cheaper and more scalable for mobile applications consideration.
Hello,
First of all, thank you for this project. It is really usefull.
I'm UnitTesting (it is, in fact, an integrated test as it connect to the server) a PCL project. WebSocket.Portable.Core is version 1.2.6 rda.SocketsForPCL is version 1.2.2 I'm trying to send a simple message to my websocket server but I get an ObjectDisposedException. The code is straightforward :
wsClient = new WebSocketClient(); wsClient.MessageReceived += WsClient_MessageReceived; wsClient.Closed += WsClient_Closed; wsClient.Opened += WsClient_Opened; wsClient.Error += WsClient_Error; await wsClient.OpenAsync("ws://myserver", 8000, false);
await wsClient.SendAsync("ping");
Everything is OK until the last line where I get the exception :
à System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) à System.IO.Stream.<>c.b__53_0(Stream stream, ReadWriteParameters args, AsyncCallback callback, Object state)
à System.Threading.Tasks.TaskFactory
1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func
5 beginMethod, Func3 endMethod) à System.IO.Stream.BeginEndWriteAsync(Byte[] buffer, Int32 offset, Int32 count) à System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) à WebSocket.Portable.TcpConnection.WriteAsync(Byte[] buffer, Int32 offset, Int32 length, CancellationToken cancellationToken) à WebSocket.Portable.WebSocketFrame.<WriteToAsync>d__48.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.TaskAwaiter.GetResult() à ShareMyPos.Client.Common.Server.ServerOpenshift.<InitializeAndStart>d__3.MoveNext() dans C:\Users\Aleksandar\Source\Repos\ShareMyPos\ShareMyPos.Client.Common\Server\ServerOpenshift.cs:ligne 31 --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.TaskAwaiter
1.GetResult() à ShareMyPos.IntegratedTests.BasicIntegratedTest.OneConnection_ShouldNotGetErrors() dans C:\Users\Aleksandar\Source\Repos\ShareMyPos\Tests\ShareMyPos.IntegratedTests\BasicIntegratedTest.cs:ligne 24@NVentimiglia, I saw your messages here : https://github.com/rdavisau/sockets-for-pcl/issues/34 You certainly found a workarround and I must be missing something ...
Can you help me please ?
Thank you. Alek