krlito / stompnet Goto Github PK
View Code? Open in Web Editor NEWAsynchronous STOMP 1.2 client library for .NET 4.5 and .NET Standard 1.5.
License: Apache License 2.0
Asynchronous STOMP 1.2 client library for .NET 4.5 and .NET Standard 1.5.
License: Apache License 2.0
I faced with a problem, that when the exception is thrown in WriteAsync method of the IStompFrameWriter instance then the TaskCancellationSource returned by SerialTaskExecutor has always state of successfull completion of the queued task. By analyzing and debugging the extension method TrySet of the class TaskCompletionSourceExtensions I'm found what the faulted awaited task, has also flag IsCompleted, so your code is never set exception in the TaskCancellationSource.
So the correct code is:
/// <summary>
/// TaskCompletionSource extensions.
/// </summary>
internal static class TaskCompletionSourceExtensions
{
public static void TrySet<T>(this TaskCompletionSource<T> tcs, Task task) where T : class
{
if (task.IsFaulted)
{
tcs.TrySetException(task.Exception.InnerExceptions);
}
else if (task.IsCanceled)
{
tcs.TrySetCanceled();
}
else
{
Task<T> taskWithResult = task as Task<T>;
tcs.TrySetResult(taskWithResult == null ? null : taskWithResult.Result);
}
}
}
Rather than a TCP connection, is there a way we can connect through a websocket connection?
Thanks
Jimmy
Hi, your lib works like a charm and the pull request from @Sbou too, plz accept the heartbeat, and publish a .net standard 2 on nuget, to run it in .net standard you don't need to change any line, your code is full compatible with it.
when i try to connect rabbitmq's stomp, the problem occur "HTTP/1.1 400 Bad Request' is not a valid STOMP server command".
We have a Websocket Stomp server built in Java (Spring based) hosted in localhost with 8080 port
We are facing an connectivity issue while using Stompclient library and getting following error -
Error list-
• Message = "This protocol version is not supported."
• DualMode = 'tcpClient.Client.DualMode' threw an exception of type 'System.NotSupportedException'
• tcpClient.Client.EnableBroadcast' threw an exception of type 'System.Net.Sockets.SocketException'
• An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
• base = {"This stream does not support seek operations."}
• HTTP/1.1 400 Bad Request' is not a valid STOMP server command.
Can anyone please suggest if you have successfully created / used any C# client library with a spring based STOMP over Web Socket server.
Please let us know if you need more details.
Appreciate your quick response..
Thanks
Vanita
A secure connection to RabbitMq using Https is failing. (using Http does connect)
This is the stack trace:
System.IO.EndOfStreamException: Poging voorbij het einde van de stroom te lezen.
bij StompNet.IO.AsyncStreamReader.<ReadNBytesAsync>d__10.MoveNext() in E:\workspace\StompNet\StompNet\IO\AsyncStreamReader.cs:regel 91
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij StompNet.IO.AsyncStreamReader.<ReadCharAsync>d__12.MoveNext() in E:\workspace\StompNet\StompNet\IO\AsyncStreamReader.cs:regel 113
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij StompNet.IO.AsyncStreamReader.<ReadLineAsync>d__16.MoveNext() in E:\workspace\StompNet\StompNet\IO\AsyncStreamReader.cs:regel 160
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bij StompNet.IO.Stomp12FrameReader.<ReadCommandAsync>d__8.MoveNext() in E:\workspace\StompNet\StompNet\IO\Stomp12FrameReader.cs:regel 99
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bij StompNet.IO.Stomp12FrameReader.<ReadFrameAsyncImpl>d__7.MoveNext() in E:\workspace\StompNet\StompNet\IO\Stomp12FrameReader.cs:regel 78
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bij StompNet.IO.Stomp12FrameReader.<ReadFrameAsync>d__6.MoveNext() in E:\workspace\StompNet\StompNet\IO\Stomp12FrameReader.cs:regel 68
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij StompNet.IO.StompFrameObservable.<ReadFrames>d__9.MoveNext() in E:\workspace\StompNet\StompNet\IO\StompFrameObservable.cs:regel 84
Unfortunately MS still has not solved the translated exceptions issue. so the top exception translates to:
Attempt to read past the end of the stream
.
Maybe put this in the readme.md to save some fellow developers time when looking for a suitable solution, or attract their interest to contribute:
Implemented so far:
Not yet supported:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.