Commit Graph

527 Commits

Author SHA1 Message Date
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
BrennanConroy 0dd29b3050 Always close websocket on server (#567)
* refactor server websockets transport
2017-06-20 16:00:32 -07:00
BrennanConroy 0298868c00 Reorganize and add more logging to Sockets.Http (#549)
* Move Sockets.Transports to internal namespace
2017-06-15 08:24:43 -07:00
Hu Weiwen 40bef1bc78 Simplify delegate invoking (#565) 2017-06-15 07:45:32 +02:00
David Fowler ae21379736 Fixed 205 status code 2017-06-13 06:00:26 +02:00
David Fowler cde0aa741a Removed unused dependencies (#558) 2017-06-13 03:03:28 +02:00
BrennanConroy 3cabb6aeb1 Don't over-discover Hub methods (#511) 2017-06-12 14:26:33 -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
Mikael Mengistu 27979d835f Clean up GroupManager (#542) 2017-06-08 17:06:41 -07:00
David Fowler 523517f60c Add support for timing out poll requests (#538)
* Add support for timing out poll requests
- Default poll request is 110 seconds (like in previous versions of SignalR)
- Use 200 with a 0 content length for timeouts.
- Added support for not timing out while debugging
2017-06-07 20:55:00 -10:00
BrennanConroy 1fad901843 Fix inherited hub auth and added tests (#535) 2017-06-06 20:55:34 -10:00
Mikael Mengistu 680c48d584 Change Group Add and Remove API (#522) 2017-06-06 21:50:34 -04:00
Pawel Kadluczka a14a0ab039 Adding structured negotiate 2017-06-06 15:53:21 -07:00
BrennanConroy 4c4be7ed6f Add support for Hub Authorize Attribute (#532) 2017-06-06 15:46:08 -07:00
Nate McMaster fd7abb31e8 Lift M.ANC.Sockets.Common to .NET Standard 2.0 2017-06-06 15:28:27 -07:00
David Fowler d8583535c8 Remove unused code 2017-06-06 10:58:29 -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
David Fowler 831fa72893 Remove the RequestId from DefaultConnectionContext (#516)
* Remove the RequestId from DefaultConnectionContext
- Added a GetHttpContext() extension method on ConnectionContext
- Also fixed an issue not setting LastSeenUtc
2017-06-03 22:05:44 -10:00
Kiran Challa 7de91da37d Merge branch 'rel/2.0.0-preview2' into dev 2017-06-03 19:28:28 -07:00
David Fowler b77f50a99a Merge DefaultConnectionContext with ConnectionState (#514)
* Merge DefaultConnectionContext with ConnectionState
- Removed ConnectionState as a result
2017-06-03 12:14:01 -10:00
David Fowler 42e2715a95 Removed EndOfMessage from Message (#513)
* Removed EndOfMessage from Message
- The webSockets transport no longer supports partial payloads so
this feature is now gone.
2017-06-03 08:32:28 -10:00
David Fowler 72423ee203 Removed custom websocket implementation (#507)
- Use the default websocket middleware
- Rewrote TestWebSocketConnectionFeature to use Channels instead of pipes
2017-06-03 06:53:39 -10:00
BrennanConroy 52f2104c78 React to Base64 API changes 2017-06-02 20:40:06 -07:00
David Fowler d10a6293bd Discover hub methods at startup time (#503)
* Discover hub methods at startup time
- Errors will show up earlier as a result instead of cryptic
first connect errors.
2017-06-01 09:47:39 -10:00
Pawel Kadluczka e31fc1e57d Closing transports with error if hubs cannot be created
- Preventing from closing long polling transport with 204 in case of
error
- Reporting an error to the client if WebSocket was not closed normally

Note in case of ServerSentEvents it is not possible on the client to
tell the difference between when the server closed event stream due to
an exception or because the client left OnConnectedAsync. In both cases
the client sees only that the stream was closed.

Part of: #163
2017-05-31 16:29:28 -07:00
Andrew Stanton-Nurse 263dd0e4fe Fix #324 by adding streaming support to the server (#461) 2017-05-31 09:10:20 -07:00
BrennanConroy 762d52133c Change Base64 to Base64Encoder (#492) 2017-05-26 17:48:36 -07:00
Mikael Mengistu b862d35b10 Update Targets (#486) 2017-05-26 20:00:12 -04:00
John Luo 47ac4e5bf9 React to Hosting changes 2017-05-26 10:53:10 -07:00
Pawel Kadluczka cb9f44ddf6 Fixing WebSocketsTransport to handle exceptions correctly
Exceptions thrown when sending or receiving messages would leave the
WebSockets transport in a half-closed state when one of the loops is
closed but the other one is still running preventing from the
Connection.Closed event to be fired.

Fixes: #412
2017-05-26 07:58:44 -07:00
Hao Kung 42739b064f React to Auth + switch to PolicyEvaluator 2017-05-25 18:22:51 -07:00
David Fowler d55ebfeee0 Split http and non-http layers (#487)
* Split http and non-http layers
- This change introduces Microsoft.AspNetCore.SignalR.Http
and Microsoft.AspNetCore.Sockets.Http which expose extension methods
on IAppBuilder for wiring up a sockets and signalr pipeline.
2017-05-24 07:09:46 -07:00
David Fowler 9d9a52119e Progress towards splitting the layers (#473)
* Progress towards splitting the layers
- This is based on the work anurse did in anurse/endpoint-middleware-spike to
introduce a connection middleware pipeline that mimics much of our http
pipeline. The intent is that this layer will be generic enough to build both
SignalR and Kestrel on top of but we're not there yet. This change makes incremental
progress towards splitting apart sockets and http so that we can add the tcp transport
without breaking everything all at once.
- Created Microsoft.AspNetCore.Sockets.Abstractions where the primitives for
sockets live. That includes, ConnectionContext (formerly Connection), EndPoint,
ISocketBuilder, SocketDelegate, etc.
- ConnectionContext isn't in it's final form as yet, it still very closely mirrors
the original Connection object we had so that tests continue to pass.
- The HttpConnectionDispatcher doesn't know about EndPoint anymore, it just cares
about invoking the SocketDelegate.
- EndPointOptions has been removed as part of this change as it coupled http specific configuration
to the end point type. There's a new HttpSocketOptions that needs to be passed into MapSocket calls.
- Updated the tests to deal with the API changes.
2017-05-23 02:43:32 -07:00
David Fowler e68a1b294f Fix long polling graceful shutdown (#476)
- If a message was sent and the application was ended in the same
poll request, the connection would be closed by the time the next poll
came in which resulted in a 404. This change waits until the transport writes
all data before closing it.
- Also fixed a test so that the exception started to show client side.

#469
2017-05-22 09:07:26 -07:00
David Fowler 323dae4ce9 Handle case where scanning happens after dispose. (#475)
- ConnectionManager.Scan would null ref because the timer.Change was being called
after closing all connections.
2017-05-21 23:19:17 -07:00
David Fowler 2aabce48b4 Remove custom routing and path matching from HttpConnectionDispatcher (#471)
- We're now using the routing system in a very vanilla way now that
we're not using the URL space as part of the protocol.
- Removed the path argument from the HttpConnectionDispatcher (simplifies code and removes duplication from tests)
2017-05-20 00:34:29 -07:00
David Fowler 240a88f7af Make the http end points more resty (#470)
- Use HTTP verbs to describe functionality for endpoints
- Updated TransportProtocols.md
2017-05-19 23:37:17 -07:00
Andrew Stanton-Nurse 8f18ff4423 react to corefxlabs changes (#464) (#465) 2017-05-19 15:06:46 -07:00
Pawel Kadluczka 4bb9721d39 Adding strongly typed Invoke and On overloads
See: #311
2017-05-19 09:47:16 -07:00
Mikael Mengistu 04863032a2 Increase the size of the WebSockets buffer to 4K. (#448) 2017-05-15 13:14:45 -04:00
Pavel Krymets 67ecd4746e Remove unnecessary package references (#446) 2017-05-10 15:14:26 -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
Pawel Kadluczka d73b490b69 Fixing SocialWeather sample 2017-05-08 12:49:57 -07:00
BrennanConroy 1da4e07fff Use common ObjectMethodExecutor (#440) 2017-05-07 10:05:21 -07:00
Andrew Stanton-Nurse ca9a44afc3 Merge branch 'rel/2.0.0-preview1' into dev 2017-05-04 14:11:16 -07:00
Mikael Mengistu 7f64811ccd Change targets (#437)
Target netcoreapp2.0
2017-05-04 14:05:58 -07:00
moozzyk 19b390c5ab Redis based scaleout presence 2017-05-01 16:35:26 -07:00
Pawel Kadluczka 632c8abf77 Single server presence 2017-05-01 16:35:25 -07:00
Mikael Mengistu 186c411f43 Clean up (#427) 2017-04-28 14:37:09 -07:00
Mikael Mengistu db868af8d8 Added stricter SSE message type parsing (#410) 2017-04-28 11:58:10 -07:00
Mikael Mengistu d19ed0070c Move Long Polling and SSE send logic to a common place (#424) 2017-04-27 15:33:23 -07:00
moozzyk 82f99a1424 Work around for a Firefox bug
Firefox won't fire EventSource open event until it receives some data. The workaround is to send an empty comment when starting ServerSentEvent transport.

Fixes: #352
2017-04-27 10:34:47 -07:00
Chris R b45e20acec Merge branch 'rel/2.0.0-preview1' into dev 2017-04-26 15:06:00 -07:00
Mikael Mengistu 74b318b3e4 Support binary messages in SSE parser (#418) 2017-04-26 15:04:48 -07:00
Chris R 0edd62339e React to IHostedService namespace change 2017-04-26 14:37:58 -07:00
Andrew Stanton-Nurse 64e9cba14d fix build broken by PlatformAbstractions (#409) 2017-04-20 14:17:45 -07:00
Mikael Mengistu 8c8f6c708b Server-Sent Events Transport + Parser (#401) 2017-04-18 16:08:48 -07:00
Andrew Stanton-Nurse 2d278009b2 clean up client sample (#392) 2017-04-18 12:41:23 -07:00
moozzyk e691e1cff8 Removing legacy raw format for `send`
Fixes issues #383 and #127
2017-04-18 11:34:43 -07:00
moozzyk db66b1e553 TransportFactory should not try creating WebSocket transport on Win7/2008R2 2017-04-11 16:34:20 -07:00
BrennanConroy 9993fd96da Use policy names in EndPointOptions (#340) 2017-04-11 12:35:31 -07:00
BrennanConroy be88d2918e Disable API Check 2017-04-11 09:23:48 -07:00
moozzyk 04719dee82 Adding transport factory 2017-04-11 09:16:36 -07:00
David Fowler 0546dc21f4 Disable response buffering via the IHttpBufferingFeature (#379)
* Disable response buffering via the IHttpBufferingFeature
- To make sure SignalR works with servers and middleware
that do perform response buffering, disable it via the
IHttpBufferingFeature for SSE.
- Added test to verify buffering is disabled
2017-04-10 19:05:06 -07:00
Kai Ruhnau 4c183b4d00 Quickly fail the UFT-8 validation if the first byte is already invalid 2017-04-10 12:23:46 -07:00
David Fowler abafae8cd3 Remove VersionPrefix from Sockets (#369) 2017-04-04 10:38:23 -07:00
David Fowler 3b8e1a5380 Added a close timeout to the web socket transport
- Today we don't end the request if the application completes
but the websocket transport hasn't gotten the receive frame as yet.
This changes adds a WebSocketOptions.CloseTimeout to EndPointOptions
that allows configuring this timeout. When the timeout is reached, we abort
the connection and end the transport task so that the request can end.
- Added tests for websocket timeout and skipped tests for application timeouts
2017-04-04 09:59:41 -07:00
David Fowler 87e6da6e4c Handle exceptions and Cancellation in DisposeAsync (#366) 2017-04-03 22:21:41 -07:00
David Fowler 8da2dddd49 Fix issue where multiple calls to dispose don't wait properly (#360)
* Fix issue where multiple calls to dispose don't wait properly
- DisposeAsync returned immediately to anyone but the first caller.
This means that it was possible to end the request before properly
waiting on the transport task which means writing after dispose was possible.
- Added a test
2017-04-03 15:25:45 -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
BrennanConroy 09667e86ab Port ObjectMethodExecutor race fix 2017-03-27 09:19:08 -07:00
BrennanConroy 6130003193 Convert to netcoreapp2.0 (#338)
* Converted samples and test projects to run on netcoreapp2.0
2017-03-25 09:37:39 -07:00
BrennanConroy 14d3f2bc9b Allow overridden methods on hubs (#334)
Allow overridden methods on hubs
2017-03-23 14:38:31 -07:00
Andrew Stanton-Nurse 28bf0b445b add some very simple, fairly stupid, benchmarks (#322) 2017-03-23 09:18:49 -07:00
Pawel Kadluczka e955c4b9aa Handling exceptions thrown when invoking a hub method (#332) 2017-03-22 11:06:47 -07:00
BrennanConroy 8f9f6bcb6f Adding Auth to endpoints 2017-03-21 10:13:56 -07:00
David Fowler 10782d59a2 Dev gate (#326)
* React to corefxlab
2017-03-21 08:48:32 -07:00
David Fowler 63ce7f6160 Supported transports (#294)
Supported transport spike
- Allow turning transports on or off per end point with a flags enum
- Added `TransportType` to Sockets.Common
- Added tests
2017-03-20 12:23:00 -07:00
Andrew Stanton-Nurse ab3dce85fc tidy up status codes and transport conflicts (#306) 2017-03-20 09:48:15 -07:00
David Fowler 6a0641f716 Try latest corefx packages (#319)
* Revert "Downgrade packages to fix build"
2017-03-18 23:24:48 -07:00
David Fowler 49baaba32c Downgrade packages to fix build 2017-03-18 02:11:49 -07:00
moozzyk 23375c911b Fixes a race where wrong task could be awaited in channel completion
We had a startTask we would await in DisposeAsync and channel completion continuation. This task would be initially set to a completed task and then once StartAsync was invoked it would be replaced with the actual task representing StartAsyncInternal. However if a transport failed immediately after starting the channel completion continuation could have been called before the StartAsyncInternal method completed. In this case we would await the inital completed task and then very likely would fail trying to await _receiveLoop task because it wouldn't necessarily be set.
The fix is to use TaskCompletionSource so we don't try to swap tasks. We need to do some additional state checks because:
- the TaskCompletionSource task may never be completed (e.g. DisposeAsync is being called without starting the connection)
- TaskCompletionSource allows setting the result only once and we should not return its task more than once (e.g. calling StartAsync after connection was successfully started and stopped)

Fixes #304
2017-03-16 13:45:18 -07:00
moozzyk 1d9da9bff8 Moving XUnitLoggerProvider to Common location 2017-03-16 13:45:18 -07:00
Andrew Stanton-Nurse 1732ac5760 add support for binary format in /poll (#303) 2017-03-16 11:06:26 -07:00
Nate McMaster c89ba8c1ec Consolidate dependency versions to one file 2017-03-15 19:34:12 -07:00
Andrew Stanton-Nurse 0133153bc9 use new protocol for '/send' (#297) 2017-03-15 18:03:23 -07:00
Andrew Stanton-Nurse fcbb43cc03 use new CoreFxLab buffer read/write primitives (#276)
* converted formatters to use IOutput
* convert parsers to use BytesReader
2017-03-14 10:28:54 -07:00
moozzyk 2f2d3a6f24 Fixing Receive/Close race
Fixing a race where removing the last message from the channel would trigger draining the event queue (in channel Completion continuation) which would prevent from raising the Received event for the very message that was read from the channel.
2017-03-14 08:49:57 -07:00
moozzyk e8ad3b4160 Adding detailed logging to the client 2017-03-14 08:49:57 -07:00
moozzyk dcdd8cfa9a Removing our own copy of NullLoggerFactory
Moving TaskQueue to the Internal folder as it is in the Internal namespace
2017-03-10 15:54:29 -08:00
moozzyk c0120dd18f Fixing build after moving to new pipelines 2017-03-09 11:13:05 -08:00
Pawel Kadluczka a00ec445ef Moving TS client to a dedicated subfolder (#274) 2017-03-09 09:42:59 -08:00
moozzyk 02df601715 Dispatching raising events to separate threads 2017-03-09 09:09:19 -08:00
moozzyk a93839e1b2 Adding TaskQueue 2017-03-08 17:30:54 -08:00
moozzyk abc9109cf3 Enabling feedback to SendAsync via asymmetric channels 2017-03-08 17:13:36 -08:00
moozzyk 62c3c15a1f Fixing a race DisposeAsync is called when StartAsync hasn't finished
Fixes: #248
2017-03-08 17:04:18 -08:00
Mikael Mengistu f374d92712 WebSockets transport now creates correct url (#268) 2017-03-07 11:03:41 -08:00
Andrew Stanton-Nurse 78dfd278c1 Integrating new transport protocols (#257) 2017-03-07 10:46:36 -08:00
Pranav K 92bedafe3a Revert "Workaround rogue System.IO.Pipelines on nuget.org"
This reverts commit 544a09dc83.
2017-03-05 08:55:36 -08:00
David Fowler 544a09dc83 Workaround rogue System.IO.Pipelines on nuget.org 2017-03-03 22:53:15 -08:00
Pawel Kadluczka 0162c19ccf MSBuildifying gulpified node (#237)
- Creating an MSBuild project for the TS client
- Adding project references to the TS client project from projects that need the client - (ensures the correct targets dependency graph and prevents building the client multiple times and related races)
- Removing gulp tasks from individual projects (allows containing npm only in the TS client source and node tests)
- Using incremental compilation to build the TS client only when inputs change (prevents building the client multiple times or when not needed at all)
- Removing `npm install` from all the projects (takes up to 10 seconds even if there is nothing to restore) - npm packages will still be installed when running full build (if needed) or need to be installed manually
2017-03-01 15:13:22 -08:00
BrennanConroy 485f9595e2 EndPoint options and injection 2017-03-01 14:38:50 -08:00
Mikael Mengistu c3b33a2676 Add Url + ILoggerFactory ctor for HubConnection (#253) 2017-02-28 16:52:42 -08:00
BrennanConroy 0abac4a20d Fix null ref in DisposeAsync on ConnectionState 2017-02-28 11:44:25 -08:00
Mikael Mengistu c1a4b25a66 Remove logger factory requirement from HubConnection (#238) 2017-02-28 10:48:45 -08:00
Nate McMaster af5e7da478 Remove workarounds and unify dependency versions 2017-02-23 17:09:07 -08:00
Andrew Stanton-Nurse 08c550655a use new Base64 codec in Text and SSE Formatters (#231)
fix #192
2017-02-22 16:26:58 -08:00
Andrew Stanton-Nurse 9767dbd5c1 fix #209 by converting to byte[] (#229)
* fix #209 by converting to byte[]
2017-02-22 11:50:37 -08:00
Andrew Stanton-Nurse 701612c859 fix #204 by implementing SSE formatter (#210) 2017-02-22 09:30:31 -08:00
Andrew Stanton-Nurse f84362cc76 one last try to get this test de-flaked (#227) 2017-02-21 16:15:32 -08:00
Andrew Stanton-Nurse 755ba7613e Fix #215 and restore tests (#218)
* fix #215 by properly handling pipe closure

* pr feedback

* pr feedback
2017-02-21 15:27:52 -08:00
moozzyk 9709139a27 Fixing a bug where pending invocations were not terminated correctly 2017-02-21 14:07:51 -08:00
moozzyk 12c6a4b917 Adding IConnection interface 2017-02-21 14:07:50 -08:00
moozzyk 7a4746868a Removing Dispose from Transport, Connection and HubConnection
Converting StopAsync to DisposeAsync
2017-02-21 13:36:54 -08:00
moozzyk cc7f835e1d Creating npm package for ts client 2017-02-21 11:37:13 -08:00
David Fowler a0dae7cb0e Revert "Revert "React to CoreFxLab changes (#225)""
This reverts commit f9529f00b9.
2017-02-20 00:40:02 -08:00
David Fowler f9529f00b9 Revert "React to CoreFxLab changes (#225)"
This reverts commit 28455f647e.
2017-02-20 00:31:06 -08:00
Pranav K 28455f647e React to CoreFxLab changes (#225) 2017-02-19 23:41:19 -08:00
BrennanConroy 6f33ebc1f5 ObjectMethodExecutor 2017-02-17 10:19:32 -08:00
moozzyk a13aa4de10 Using webSockets transport as the default transport
Fixes: #213
2017-02-17 09:58:23 -08:00
Nate McMaster 92b3cb1592 React to API changes in System.Text.Primitives 2017-02-15 14:23:11 -08:00
Nate McMaster f684fcb574 Downgrade to stable packages 2017-02-15 14:23:11 -08:00
moozzyk a3e847e6cc De-statificying HubConnection
Wiring and raising events correctly
2017-02-15 12:15:35 -08:00
moozzyk d4fbdd055a Raising Received event 2017-02-15 12:15:35 -08:00
moozzyk 4f6306f352 Adding rasing Connected and Closed events 2017-02-15 12:15:35 -08:00
moozzyk 966470d269 Adding connection state 2017-02-15 12:15:34 -08:00
moozzyk 3ba95b98af Converting static ConnectAsync to instance StartAsync 2017-02-15 12:15:34 -08:00
Andrew Stanton-Nurse 70d97dd7b8 finish binary protocol formatter/parser (#203) 2017-02-15 12:11:52 -08:00
moozzyk 94dc265658 Fixing build after merge 2017-02-15 09:49:39 -08:00
Mikael Mengistu cb7692d16e WebSockets Transport (#185)
WebSockets transport
2017-02-15 09:24:41 -08:00
Andrew Stanton-Nurse a728e1da41 Text Protocol Formatter (#187) 2017-02-14 16:00:51 -08:00
David Fowler fc93c47789 Use Monitor.TryEnter/Exit in the Scan loop (#189)
- Avoids overlapping Scans
- Noops if dispose is being called at the same time
2017-02-10 16:34:31 -08:00
moozzyk 633c572a22 Fixing build 2017-02-09 10:59:41 -08:00
Pawel Kadluczka 0c8df245de Hiding Channels (#183)
Hiding Channels
2017-02-09 10:31:07 -08:00
Nate McMaster 7281bf90c0 Upgrade to VS 2017 (#176) 2017-02-02 12:54:23 -08:00
Mikael Mengistu 5def499323 Added Sockets.Common and connection level testing (#173)
*Moved IChannelConnection, ChannelConnection, Format and Message to the new Sockets.Common project.

* Adding Connection level tests.
2017-01-31 14:59:21 -08:00
Dan Kirkham b32d3ad4e1 Removed explicit capturing of "this" for lamdas (#167)
* Removed explicit capturing of "this" for lamdas

* Capture current Id when invoking connection
2017-01-31 13:47:14 -08:00
David Fowler eafbe74160 Fixed parameter count mismatch when invoking methods with wrong case (#162)
* Fixed parameter count mismatch when invoking methods with wrong case
- Hub methods were being tracked with 2 dictionaries, one for parameter names
the other for callbacks. This change introduces a single dictionary that stores
the hub name to a HubMethodDescriptor. That descriptor stores the parameter types
and method info for the bound hub method.
- The callback is now just an invoke method on the HubEndPoint itself.
- Added tests for case sensitivity in hub method names
2017-01-26 18:25:49 +00:00
moozzyk c997ea8165 Converting pipelines to channels 2017-01-26 08:04:58 -08:00
moozzyk 1119bcf1b3 Sharing channel connections 2017-01-26 08:04:56 -08:00
David Fowler 05cc7792df Synchronize the background scan and closing of connections
- It was possible for the application to be torn down during
a background scan. When that happened, the timer would be disposed
before the end of the scan and would throw an ObjectDisposedException
when timer resumption happened. This change introduces a lock that avoids that
race.

Fixes #161
2017-01-26 07:50:29 +00:00
David Fowler 162cd1fc06 Handle misbehaving user code (#159)
* Handle misbehaving user code
- Execute EndPoint logic on a threadpool thread
- Turn synchronous exceptions into async ones to unify the
error handling
- Added tests
2017-01-25 23:45:43 +00:00
David Fowler 934f6a70d1 Various fixes in HttpConnectionDispatcher (#151)
- The connection state object is manipulated by multiple parties in a non thread safe way. This change introduces a semaphore that should be used by anyone updating or reading the connection state. 
- Handle cases where there's an active request for a connection id and another incoming request for the same connection id, sse and websockets 409 and long polling kicks out the previous connection (https://github.com/aspnet/SignalR/issues/27 and https://github.com/aspnet/SignalR/issues/4)
- Handle requests being processed for disposed connections. There was a race where the background thread could remove and clean up the connection while it was about to be processed.
- Synchronize between the background scanning thread and the request threads when updating the connection state.
- Added `DisposeAndRemoveAsync` to the connection manager that handles`DisposeAsync` throwing and properly removes connections from connection tracking.
- Added Start to ConnectionManager so that testing is easier (background timer doesn't kick in unless start is called).
- Added RequestId to connection state for easier debugging and correlation (can easily see which request is currently processing the logical connection).
- Added tests
2017-01-25 22:27:55 +00:00
Dan Kirkham acd1dc5e24 Fixed inconsistent single quotes (#154) 2017-01-25 09:43:02 -08:00
David Fowler 9eb42cce2d Clean up disposal of connection state (#148)
* Clean up disposal of connection state
- Removed IDisposable and added a DisposeAsync method to ConnectionState
- Added ApplicationTask and TransportTask to ConnectionState as first class
properties so that it is easy to see (in a process dump or debugger) the
outstanding tasks that Sockets is keeping track of on a per connection basis.
2017-01-25 00:08:08 +00:00
David Fowler a1c8d3d841 Fix the TS client to respect the new endpoint
- Seems like the ts client wasn't updated to use /negotiate instead
of /getid
2017-01-24 21:12:53 +00:00
David Fowler 1e957a9e5a Allow processing of incoming invocations in parallel (#143)
* Allow processing of other incoming invocations in parallel
- Don't wait on the response of an invocation to pick up
the next message from the channel.
- Unhandled exceptions should continue bubbling up correctly
2017-01-24 20:46:17 +00:00
BrennanConroy aec52670b4 React to Channel API changes 2017-01-19 08:15:59 -08:00
Pawel Kadluczka ac8a6c9f67 Adding infrastructure to write node (a.k.a. unit) tests for ts client (#129) 2017-01-18 13:25:23 -08:00
Andrew Stanton-Nurse 464077866c rename getid to negotiate (#124)
* rename getid to negotiate
* also change SSE and Long Polling to require a pre-established connection
* disallow changing transports mid-connection; return a 400 response if the user attempts to do so
2017-01-17 15:45:29 -08:00
BrennanConroy 3d5fc9493a Remove format from connect and only use it in /send 2017-01-17 11:32:27 -08:00
David Fowler 172a20c4ec Use WaitToWriteAsync(), TryWrite() in HubLifetimeManager(s) (#122) 2017-01-11 22:13:12 -08:00
David Fowler 8dc68cb798 Use TryRead and TryWrite (#113)
* Use TryRead and TryWrite
- Use TryWrite to avoid errors on channel close for /send requests
- Use TryRead until it returns false for all transports but long polling
2017-01-11 12:27:18 -08:00
BrennanConroy b3df10b638 Use connections format 2017-01-11 10:07:15 -08:00
David Fowler cd9ed9228a Remove streaming transport as a top level API (#110)
- Remove Streaming* classes from Sockets. The main
API will be channels based and streaming transports
will use the PipelineChannel (formerly FramingChannel) to
access messages.
- Added WriteAsync and ReadAsync to Connection and hid
the IChannelConnection from public API.
- Also fixed the fact that unknown methods caused server side
exceptions.
- Changed the consumption pattern to WaitToReadAsync/TryRead to avoid
exceptions.
- React to API changes
2017-01-11 04:01:49 -08:00
BrennanConroy 9dbb3742c8 Adding more tests 2017-01-10 16:27:23 -08:00
moozzyk a9c7e14da0 Making HttpClient configurable and reusable 2017-01-10 16:19:26 -08:00
David Fowler bd19022c4c Fixed teardown for streaming connections
- Added mega hack for cancellation until we get newer pipeline
implementations.
2017-01-10 14:32:10 -08:00
David Fowler baf7fce49d Made some fixes to the disconnect sequence
- Fixed ChannelConnection to use IChannel<T> for
both sides of the connection. This allows use to close both the
input and the output when we are tearing down.
- Use TryComplete instead of complete to avoid exceptions thrown on
Complete(), particularly ChannelClosedException.
2017-01-10 14:32:10 -08:00
Andrew Stanton-Nurse 0af0318f43 fix rebase error
re-removed error handling from HubEndpoint, since HttpConnectionDispatcher handles it
2017-01-10 13:49:41 -08:00
Stephen Halter b977c871ae Remove unnecessary explicit dependency 2017-01-10 00:14:09 -08:00
Andrew Stanton-Nurse d281cb72ea add "messaging" endpoints and transports
* Need a separate set of primitives to handle messaging
* Using Channels (not Pipelines!) to provide the data flow for messaging
* All transports are now "message" based transports
* Added an adaptor to convert message-based transports to serve
streaming endpoints
2017-01-09 16:01:08 -08:00
moozzyk 217f707456 Sorting out exceptions
Making sure that OnConnected/OnDisconnected events are invoked correctly (e.g. if invoking OnDisconnectedAsync on hub threw we would not call OnDisconnectedAsync on lifetime manager and therefore we would continue to use/track connections that were already closed)
2017-01-09 08:29:44 -08:00
Pawel Kadluczka dbf27c30c3 Introducing HubActivator (#83)
Fixes #60
2016-12-30 11:42:02 -08:00
moozzyk 8022afd3a2 Handling exceptions thrown on the server side
Addresses: #62
2016-12-26 22:39:48 -08:00
moozzyk 3a01d6cff1 Introducing async/await in TS client + minor clean up 2016-12-26 22:23:39 -08:00
Ajay Bhargav Baaskaran 12da346de9 Updating missed projects to 4.4 CoreFx packages 2016-12-22 14:37:42 -08:00
Pranav K 1492b41af0 Updating to 4.4 CoreFx packages 2016-12-21 22:57:01 -08:00
Mikael Mengistu 23c0522db9 Added missing copyright and license headers 2016-12-19 14:30:43 -05:00
Mikael Mengistu e1d9aa2dd4 Early version of the .NET Client 2016-12-14 10:04:48 -08:00
David Fowler df9057a6f7 Revert "Revert "React to hosting changes""
This reverts commit 12649b19bf.
2016-12-14 00:01:35 -08:00
David Fowler 12649b19bf Revert "React to hosting changes"
This reverts commit f48bd8d185.
2016-12-13 23:56:10 -08:00
David Fowler f48bd8d185 React to hosting changes 2016-12-13 23:03:20 -08:00
moozzyk 46cf13b2fc Hub connection tests 2016-12-09 11:43:49 -08:00
moozzyk d3e625c985 End-to-end browser tests 2016-12-09 11:36:56 -08:00
Pawel Kadluczka 2b918b8fe2 Removing type name from hub method name (#63) 2016-12-06 11:17:00 -08:00
David Fowler 5f3c1060ab Clean up shutdown management (#59)
* Clean up shutdown management
- ConnectionManager now implements IApplicationEvents. It makes testing cleaner
but makes service registration a little messy.

* Cleaned up service registration and layering a bit
- Added SocketsApplicationLifetimeEvents instead of implementing it
on ConnectionManager directly.
- Exposed ConnectionManager.CloseConnections()
2016-12-05 22:07:19 -08:00
BrennanConroy 28e3c8331b Dispose Hubs from ActivatorUtilities 2016-12-05 15:40:01 -08:00
moozzyk e6b34fdce3 Renaming RpcConnection to HubConnection 2016-11-29 16:03:56 -08:00
Russell Seamer 4158dfed8f add net451 support to signalr.redis 2016-11-29 14:52:44 -08:00
moozzyk 2039a18971 Introducing modules for the ts client 2016-11-29 12:35:33 -08:00
David Fowler 1b59fc6f80 DI enabled Microsoft.AspNetCore.Sockets (#47)
* DI enabled Microsoft.AspNetCore.Sockets
- Added AddSockets extension method to IServiceCollection
- Inject IApplicationLifetime into ConnectionManager to handle
graceful shutdown and added test.
- Call AddSockets from AddSignalR

* PR feedback
- Added AddSignalR overload that takes Action<SignalROptions>
2016-11-26 23:09:38 -08:00
Andrew Stanton-Nurse 940ccf5c65 add tests to WebSockets transport (#35)
* add tests to WebSockets transport
* adds some error handling
* make logger factory required
* allow frames to be received after the application closes the output
2016-11-23 11:26:12 -08:00
moozzyk f0a24720bc Fixing build 2016-11-16 16:47:53 -08:00
BrennanConroy 35a1c4fae7 Add prefix to redis channel names 2016-11-16 09:58:10 -08:00
David Fowler 4aa65cf0bf Updated to new System.IO.Pipelines package instead of Channels 2016-11-15 21:46:18 -08:00
Andrew Stanton-Nurse f3ebe03a0b fix #32 by handling connection header correctly (#33) 2016-11-15 16:22:50 -08:00
Andrew Stanton-Nurse 2431c5925c integrate Channels-based WebSockets into SignalR (#28) 2016-11-15 15:05:45 -08:00
moozzyk 325c909dff Removing transport fallback in the client 2016-11-14 14:42:53 -08:00
Pranav K 97bf8c3c09 Fix NuGetPackageVerifier issues 2016-11-11 11:44:20 -08:00
moozzyk 10c741b14e Updating dependency version to fix a 0.3.0 => 1.1.0 upgrade warning 2016-11-11 10:49:54 -08:00
Pranav K 67129b2515 Update dependency versions 2016-11-10 10:27:21 -08:00
David Fowler 48b869f026 Don't hardcoded localhost for redis
- It breaks the *nix clients
2016-11-09 02:06:31 -08:00
BrennanConroy 812bffe6d0 Null check for deserialize 2016-11-08 15:41:54 -08:00
Andrew Stanton-Nurse 02c98137c7 install tsc during build (#17)
fixes #13
2016-11-08 15:31:02 -08:00
Andrew Stanton-Nurse 2de8f98a62 update doc comments on WebSocketConnection 2016-11-08 09:15:58 -08:00
David Fowler 9c592dac50 Builds on non windows 2016-11-08 00:47:09 -08:00
David Fowler a5d38f4b64 Removed empty array 2016-11-07 23:57:09 -08:00
David Fowler 7d6b247780 Move argument conversion for json into JsonNetInvocationAdapter 2016-11-07 23:55:54 -08:00
David Fowler d00f1f93b2 Added support for net451 and netstandard1.3
- Replaced Task.CompletedTask with TaskCache.CompletedTask
- Updated tests and src
2016-11-07 21:39:19 -08:00
David Fowler 239999e4c9 Make things actually work (#10)
- Added build.cmd
- Renamed the solution to match our conventions
- Fixed bad doc comment references
- Used strong name version of StackExchange.Redis
2016-11-07 20:58:41 -08:00
Andrew Stanton-Nurse dfa9c927b7 clean up project.jsons and NuGet.config (#9)
* clean up project.jsons and NuGet.config
* clean up netstandard references
* clean up netstandard tfm
* change WebSockets descriptions
2016-11-07 14:00:41 -08:00
Andrew Stanton-Nurse d299cc9186 apply license headers 2016-11-07 12:00:04 -08:00
David Fowler 217223e636 Generics overload
- Changed IHubConnectionContext and friends to be generic.
- Hub by default is Hub<IClientProxy>. We'll enable dynamic and arbitrary TClients in another commit.
2016-11-05 10:53:54 -07:00
David Fowler 9c10b89fa8 Small tweaks to sample
- Fix redis issues with removing while
- Use string interpolation in the Chat hub
2016-11-04 01:50:55 -07:00
David Fowler 6b3d9bd96d Added group messaging to the sample
- Clean up some boiler plate
- Renamed Add/Remove on GroupManager to AddAsync and RemoveAsync
2016-11-04 01:28:49 -07:00
David Fowler 6ccc8d6195 Remove params from HubLifetimeManager 2016-11-04 00:37:04 -07:00
David Fowler 23eb8aa7bd More redis tweaks
- Implemented the task queue
- Only subscribe to user channel if authenticated
2016-11-03 21:07:04 -07:00
BrennanConroy ed41672381 Implemented better Redis scaleout
- Less subscriptions and connections to RedisHubLifetimeManager
2016-11-03 19:03:44 -07:00
BrennanConroy dbd738726a Remove unused usings 2016-11-03 15:00:13 -07:00
BrennanConroy 60bc57fb8d Fix redis subscriptions and missing awaits 2016-11-03 14:58:27 -07:00
David Fowler b114e4e9fd Get rid of RpcEndpoint and samples
- Merge RpcEndpoint and HubEndPoint, still need to move discovery of hub
methods to another class.
2016-11-03 00:17:01 -07:00
David Fowler f51fcadeb1 Dispose the ConnectionManager on application shutdown 2016-11-02 23:14:12 -07:00
Pawel Kadluczka 8d03c014fb Fixing invocation results for tasks whose result is `VoidTaskResult` 2016-11-02 22:52:52 -07:00
David Fowler 5f23231d9b Make ConnectionMetadata object,object dictionary 2016-11-02 22:30:16 -07:00
David Fowler 0e690d636f Remove casts where possible 2016-11-02 22:17:03 -07:00
David Fowler 7db1eb8f25 Add Async suffix to everything 2016-11-02 22:02:29 -07:00
David Fowler a175609bb1 Start transport before endpoint 2016-11-02 21:28:05 -07:00
David Fowler b6f15338eb Cleanup and shuffling things
- Moved the InvocationAdapterRegistry registration to SignalROptions
- Moved the JsonNetInvocationAdapter to Microsoft.AspNetCore.SignalR
- Remove dead JavaScript code
2016-11-02 20:54:58 -07:00
David Fowler 8dd61250f4 Fix the projects
- Fixed dependencies
- Fixed NS dependency
2016-11-02 18:50:57 -07:00
moozzyk 2bbca5e7fe Adding error handling
Fixing SSE transport on the server
2016-11-02 17:09:11 -07:00
moozzyk 61c527f23c Fixing LongPolling transport 2016-11-02 17:09:11 -07:00
moozzyk ce17f0d19a Adding transport selection
Fixing serverSentEvents transport
Updating the client 'app'
2016-11-02 17:09:11 -07:00
moozzyk 752f329036 WIP:
- separating Connection from RpcConnection
- fixing WebSockets transport to work after rewrite
- clean up
2016-11-02 17:09:11 -07:00
moozzyk 466c8d9db9 Adding ServerSentEvents 2016-11-02 17:09:11 -07:00
moozzyk 181053e876 Adding longpolling 2016-11-02 17:09:11 -07:00
moozzyk 29d859b383 WIP 2016-11-02 17:09:11 -07:00
Pawel Kadluczka 5663198733 WIP 2016-11-02 17:09:11 -07:00
moozzyk 6859d33536 ts-client WebSockets + JSON 2016-11-02 17:09:11 -07:00
moozzyk 5e3be6e212 Awaiting tasks returned from hubs and getting the actual result 2016-11-02 17:03:30 -07:00
Andrew Stanton-Nurse b2108a6d65 major updates to WebSockets implementation
* Ping/Pong handling
* UTF-8 validation
* Customization through WebSocketOptions
* Closes connection on Protocol Errors
* Autobahn Test Suite integrated
2016-11-02 11:27:56 -07:00
David Fowler 9e7513a7bd Added UseSignalR 2016-11-02 03:20:44 -07:00
David Fowler 6af6db67f4 More refactoring
- Moved the IHubConnectionContext implementation out of HubEndPoint
- Added IHubContext to allow getting at the publish side of things without
 being in side the hub. The HubEndPoint now injects this as well.
- HubContext has the implementation of the IHubConnectionContext
- Moved ISignalRBuilder and SignalRBuilder into their own files
2016-11-02 03:03:35 -07:00
David Fowler f41bcb9b2d Subscribe in parallel 2016-11-02 02:46:52 -07:00
David Fowler 377711f68c Changes to redis and groups
- Made group add and removal async as they may be backed by a network
connection
- Added ISignalRBuilder and a pattern similar to mvc for doing extension methods off
AddSignalR
- Added RedisOptions
2016-11-02 02:29:04 -07:00
David Fowler 40039afd4f Make a SignalR project and SignalR.Redis project
- Moved RPC into SignalR for now since we don't have a middle layer yet.
- Fixed up name spaces
2016-11-02 01:49:05 -07:00
David Fowler 53858495dc Hubs are more fleshed out (#11)
- `HubEndPoint<T>` : `RpcEndPoint<T>` where T is the Hub type. Optimizing for a single hub per connection here.
- Hubs get OnConnectedAsync and OnDisconnectedAsync methods that are invoked at the right time and with the right scope.
- Introduced HubLifetimeManager<THub> (naming TBD) which is the center of the universe for Hub behaviors.
2016-11-01 23:15:31 -07:00
moozzyk ffc0a048e3 Addressing review comments 2016-10-27 09:30:20 -07:00
moozzyk fd10deba6c Removing formatters 2016-10-27 09:30:19 -07:00
moozzyk a8c831bad6 Very hacky protobuff support 2016-10-27 09:30:06 -07:00
moozzyk fb387ed03d Decoupling formatters from endpoints
Moving formatters out from Sockets
2016-10-25 16:37:23 -07:00
moozzyk 8b905907fe Typed formatters 2016-10-25 16:37:22 -07:00
moozzyk f64c986b5d Adding support to non-Json hub invocation 2016-10-25 16:37:21 -07:00
Andrew Stanton-Nurse affcb935d7 clean-up and renaming
renamed WebSockets project to clarify it's internalityness
2016-10-17 15:27:23 -07:00
Andrew Stanton-Nurse d2dbd473a0 @davidfowl love dat Func<...,object,...>,object pattern 2016-10-14 15:09:06 -07:00
Andrew Stanton-Nurse a1c0970222 move prototype WebSockets-over-Channels code in
nothing is wired up to anything in Sockets yet, it's just a copy of the
code
2016-10-14 14:36:18 -07:00
David Fowler 8bd8887213 Don't call CompleteReader, the dispatcher can handle that 2016-10-09 15:07:30 -07:00
David Fowler 08bba972c1 React to channel API changes 2016-10-07 16:18:23 -07:00
David Fowler eef2f14c78 Flush even before we get end of message 2016-10-07 01:06:04 -07:00
moozzyk bbecb0c0dc Fixing SSE transport
Content-Encoding: identity disables all the transformations and therefore fixes the issue where IIS is buffering SSE data
2016-10-06 14:20:54 -07:00
David Fowler 3032909f3c Added tests 2016-10-04 01:32:30 -07:00
David Fowler e5e8d1bee3 Decouple the dispatcher from routing for easier testing 2016-10-04 00:12:07 -07:00
David Fowler 411f44f263 Reduce code duplication 2016-10-03 23:52:51 -07:00
David Fowler 1647432ef6 Added Connection property to EndPoint
- Exposes a list of connections for user code to act on
- The connection list is thread safe (uses a concurrent dictionary under the hood)
- Removed the Bus and just used the connection list in the samples
2016-10-03 22:58:56 -07:00
moozzyk 4cd4ddfad5 More structed connection metadata 2016-10-03 14:03:10 -07:00
David Fowler 2b7a396670 When EndPoint ends, the connection ends. 2016-10-03 02:41:28 -07:00
David Fowler 99d7aea78c Add User to Connection 2016-10-03 02:08:31 -07:00
David Fowler 8e66d63577 Code cleanup (somewhat)
- Transports have be drastically simplified due to channels
- Make sure tasks don't leak
2016-10-03 01:52:18 -07:00
David Fowler e018fe70f7 Handle message fragments 2016-10-02 23:41:06 -07:00
David Fowler 9ee33bf01f Add transport connection metadata 2016-10-01 23:49:07 -07:00
David Fowler 1ad1120c41 Update the LastActive for reserved connections 2016-10-01 15:59:20 -07:00
David Fowler 2a369f40f6 Small fixes
- Pass the Connection to each IHttpTransport
- FlushAsync after writing for WebListener
- Add metadata to Connection
- Added WebListener dependency
2016-10-01 11:52:50 -07:00
David Fowler 9f5ef70164 Added support for websockets
- Upgraded to ASP.NET Core 1.1 preview
2016-10-01 10:26:49 -07:00
David Fowler 40ecc9df4d Remove GetOrAdd from AddNewConnection 2016-10-01 03:53:00 -07:00
David Fowler f4f763f136 Only run next queued task if the previous was successful 2016-10-01 03:29:49 -07:00
David Fowler 5baaaac22d Added comments and more tiny code clean up 2016-10-01 03:22:09 -07:00
David Fowler 5195e75b74 Tiny tweaks 2016-10-01 03:09:07 -07:00
David Fowler 813222b406 More cleanup + TaskQueue
- Introduced the TaskQueue
- Added IHttpTransport so abort callbacks can happen outside of the
transport implementation
2016-10-01 03:03:20 -07:00
David Fowler ad2724b22c Split Connection and ConnectionState 2016-10-01 00:57:35 -07:00
David Fowler 7b8e947567 Use new CopyToAsync method 2016-10-01 00:51:51 -07:00
David Fowler c3753c4f0e Renamed the project and split into class library and sample 2016-10-01 00:43:33 -07:00
David Fowler de291d4d2a Refactoring
- Move http stuff into Http dispatcher
- Exposed IChannel from connection
- Clean up ConnectionManager (tho it's not great yet)
2016-09-30 22:11:29 -07:00
moozzyk 239b5f815f Fixing longpolling 2016-09-30 15:13:21 -07:00
moozzyk 32ed7ca0c4 SSE kind of works - duplicate messages 2016-09-30 14:21:37 -07:00
David Fowler 27ddb7de90 More cleanup 2016-09-30 02:41:07 -07:00
David Fowler 03352354dc Initial commit 2016-09-30 01:44:56 -07:00