Commit Graph

46 Commits

Author SHA1 Message Date
David Fowler 4a568e90d2
API review changes (#1992)
- Changed GetMessageBytes to return ReadOnlyMemory
- Make HandshakeProtocol.SuccessHandshakeData a readonly field
2018-04-13 00:25:02 -07:00
Ben Adams 8a3516284e Add GetMessageBytes to IHubProtocol (#1915) 2018-04-10 07:14:09 -07:00
David Fowler c1049b722d
The grand unification of ConnectionContext (#1895)
This change rationalizes the 2 very similar abstractions that exist in Connections.Abstractions, IConnection and ConnectionContext. It also introduces an IConnectionFactory to SignalR that is used to create a new ConnectionContext for a HubConnection.

- HubConnection just completes both ends of the transport pipe instead of calling DisposeAsync.
- Implemented ConnectionContext on HttpConnection and added HttpConnectionFactory
-  Updated tests
2018-04-07 16:19:01 -07:00
James Newton-King e7b84b753b
Refactor HubConnectionBuilder (#1830) 2018-04-04 21:19:13 +12:00
BrennanConroy 903a9ea6a0
Use IBufferWriter in IHubProtocol (#1791) 2018-03-30 17:30:08 -07:00
Andrew Stanton-Nurse 6b3a27e73c
Bedrock Renames (#1777) 2018-03-30 15:09:19 -07:00
David Fowler 19b9dca268
Change IHubProtocol interface to support partial parsing (#1745)
- These are the finishing touches before we disable batching on the
C# client and on the server. We're changing the IHubProtocol interface to
modify the input buffer with what was consumed. We're also changing it
to parse a single message at a time to be match what output writing does.
- Added TryParseResponseMessage and made it look like TryParseRequestMessage
2018-03-28 12:08:16 -07:00
Andrew Stanton-Nurse cfaa123eb8 IConnection refactoring (#1718)
- IConnection is now single-use and HubConnection creates a new instance
for reconnecting
- IConnection is just a Pipe now, no more events
2018-03-27 23:02:07 -07:00
David Fowler 2e63e5afe3
The rename games part 1 of many (#1696)
- React to rename of EndPoint to ConnectionHandler
- Rename UseSockets to UseConnections
- Rename MapEndPoint to MapConnectionHandler
- Rename HttpSocketOptions to HttpConnectionOptions
2018-03-22 22:35:55 -07:00
BrennanConroy a47e1051e8
Add protocol version to handshake (#1666) 2018-03-22 15:54:35 -07:00
David Fowler b792fcb4ef
Reduce the per message read allocations (#1635)
- Introduced Utf8BufferTextReader that writes buffers directly into
the char[] allocated by JSON.NET when reading via the JsonReader.
- Use IArrayPool implementation over ArrayPool<char> when reading
incomming messages.
- Replaced JToken parsing with manual parsing using JsonTextReader.
- Added tests for parsing incoming JSON messages with out of order
properties.
- Make access to message headers lazy
- Changed IHubProtocol.TryParseMessage to be ReadOnlyMemory<byte> instead of ReadOnlySpan<byte>
2018-03-18 15:16:03 -07:00
David Fowler dc0567690d
Use features from Protocol.Abstractions (#1594)
- This is part of the grand unification of the connection layer between SignalR and Kestrel
2018-03-14 08:17:07 -07:00
BrennanConroy 62956530ae
Rename StreamAsync to StreamAsChannelAsync (#1587) 2018-03-13 15:04:11 -07:00
Andrew Stanton-Nurse fb6121399c
Remove support for binary over SSE and add transfer format to negotiation (#1564) 2018-03-13 14:29:32 -07:00
David Fowler 6c22f25818
Client pipelines (#1435)
- Reworked the Client to be based on pipelines instead of Channels
- SendAsync no longer fails if the http request itself fails but the connection is closed as a result.
- Updated tests
- Base64Encoder needed to support multiple messages in the same span of data
2018-02-12 22:27:43 -08:00
BrennanConroy 5ade419c53
Fix flaky test (#1397) 2018-02-01 15:13:40 -08:00
Andrew Stanton-Nurse b61dc35ee6
fix #1199 by suppressing ODE in received callback (#1395) 2018-02-01 15:08:52 -08:00
Pawel Kadluczka 66ab939cff Making HttpConnection restartable (C#) (#1147)
🎉
2017-12-12 10:08:42 -08:00
Andrew Stanton-Nurse a8330067c4
Implement #1157 by adding client timeout for C# client (#1165) 2017-12-07 14:54:41 -08:00
Andrew Stanton-Nurse c1d2024864
Implement #1156 by having the server send Ping messages (#1161) 2017-12-04 14:43:27 -08:00
Andrew Stanton-Nurse cb3124be17
First pass at Keep Alive (#1119)
This adds the Ping message type and support for sending/receiving it in the Hub Protocols. It does not add the logic to transmit keep-alive frames.
2017-11-16 09:45:13 -08:00
Pawel Kadluczka 379160707f
Switching to new base64 APIs (#1127) 2017-11-16 09:20:40 -08:00
BrennanConroy 792745ad98 React to CoreFxLab packages (#998) 2017-11-13 15:05:35 -08:00
Mikael Mengistu 1a21fd49b1
Changing the Closed Event to be a Task (#1080) 2017-11-09 17:51:13 -08:00
Pawel Kadluczka 06475270ec
Actually throwing exceptions from SendAsync (#1084)
SendAsync was using InvokeCoreAsync code to send messages. In case of exception InvokeCoreAsync is blocking and returns a task to the user so they can await for the remote call to complete. Any exception thrown is caught and used to fail the task returned to the user. SendAsync does not return a special task to the user so re-using InvokeCore resulted in swallowing exceptions. While SendAsync is fire and forget it actually should throw if the message could not be send and it was not happening.

While adding tests it turned out we did not test cases where Invoke/SendAsync/StreamAsync were invoked before starting the connection and this resulted in a NullReferenceException. I also fixed that.
2017-11-03 13:15:11 -07:00
Mikael Mengistu 04d4da2987 Replace Received Event with OnReceived (#1006) 2017-10-18 17:10:51 -07:00
Mikael Mengistu 72514f3943 Removing the connected event (#989) 2017-10-05 11:12:18 -07:00
Pawel Kadluczka 126901a08f Adding default ctors for HubProtocols 2017-09-21 15:30:23 -07:00
Pawel Kadluczka 4ac8e786cf Adding HubConnectionBuilder 2017-09-07 10:04:42 -07:00
Pawel Kadluczka 0ebd33a25c Plumbing TransferMode on the client side 2017-07-14 10:45:28 -07:00
Mikael Mengistu 2597e52e53 Rename HubConnection Extension Methods from Invoke to InvokeAsync (#637) 2017-07-05 22:56:03 -07:00
David Fowler 0f4295f90e Make parsers stateless (#628)
* Make parsers stateless
- Changed parser input to ReadOnlySpan<byte> to ReadOnlyBuffer<byte>
2017-07-01 23:44:22 -07:00
Mikael Mengistu d68de2b5ea Make Client Side Event Handlers Async (#610) 2017-06-28 22:39:59 -07:00
David Fowler 6332e98d03 Remove Try from Write methods (#614)
- We write to a Stream so it should never fail (it could throw
but that's not new).
2017-06-28 21:53:23 -07:00
Pawel Kadluczka f8d91b54d4 MsgPack end-to-end
Plugging in MsgPack protocol
Adding negotiation message to hub protocol
2017-06-27 18:40:55 -07:00
David Fowler 41f54d001b Remove dependencies on a bunch of corefxlab things (#576)
* Remove dependencies on a bunch of corefxlab things
- Used Stream instead of IOutput
- Removed pipelines dependency in most places.
2017-06-22 09:23:52 -07:00
David Fowler 12917ef0e9 Re-layer the .NET Client into Http and non-Http (#544)
* Re-layer the .NET Client into Http and non-Http
- Moved IConnection to Sockets.Abstractions and removed
HttpConnection and TransportType dependency.
- Renamed Sockets.Client to Sockets.Client.Http
- Renamed Sockets.Common to Sockets.Common.Http
- Renamed Connection to HttpConnection
- Removed HTTP dependency from HubConnection
- Removed tests that were testing connection logic in HubConnection

#518
2017-06-09 08:58:54 -10:00
Pawel Kadluczka a14a0ab039 Adding structured negotiate 2017-06-06 15:53:21 -07:00
David Fowler 59a8f5f3b5 Simplify the JSON and protobuf protocols (#524)
- Remove message type and message format
- Updated tests
2017-06-06 07:18:23 -10:00
David Fowler 38efde7b50 Merge transport and hub protocols (#517)
* Merge transport and hub protocols
- This change merges the transport and hub protocols into a single protocol. The
idea being that sockets in a purely streaming layer that sends frames from the underlying
transport. This makes things like TCP possible and doesn't impose a framing layer at the lowest
level. This will make it possible to build servers like kestrel on top of the TCP layer.
- The Message was removed from the lowest layer of the stack and pushed into the hubs layer. Hub invocations
are framed with what was before the transport protocol. Connections also need to state upfront if they support
binary or not. This will determine how data will be serialized to the specific connection.
- Changed the SSE parser and writer to be strictly SSE without any of the transport protocol specific
information.
- To ensure we aren't using types in the wrong layers
- Moved protocol logic into SignalR
- Socket.Abstractions is now the root of the universe, Sockets.Common will likely be removed
or turned into Sockets.Common.Http.
- Move SSE parser to Sockets.Client and SSE writer into Sockets.Http
- Moved tests into the appropriate test projects
- Updated the spec
2017-06-05 09:45:40 -10:00
Pawel Kadluczka 4bb9721d39 Adding strongly typed Invoke and On overloads
See: #311
2017-05-19 09:47:16 -07:00
Andrew Stanton-Nurse 991c1d8517 Implement new Hub Protocol (Part Deux) (#390)
* convert to new protocol
* removed InvocationDescriptorRegistry because we're not yet sure about custom protocols
* update SocialWeather sample
* Moving ts client to using new protocol
* make the functional tests a little easier to run on ctrl-f5
2017-05-09 12:24:58 -07:00
moozzyk 04719dee82 Adding transport factory 2017-04-11 09:16:36 -07:00
Alexis Nowikowski 3d29b7854b Bugfix issue #355: Don't handle Invocation when no InvocationHandler … (#356)
- Don't handle Invocation when no InvocationHandler is present
2017-03-31 09:44:57 -07:00
Pawel Kadluczka e955c4b9aa Handling exceptions thrown when invoking a hub method (#332) 2017-03-22 11:06:47 -07:00
Andrew Stanton-Nurse ab3dce85fc tidy up status codes and transport conflicts (#306) 2017-03-20 09:48:15 -07:00