Commit Graph

66 Commits

Author SHA1 Message Date
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
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
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
Mikael Mengistu b862d35b10 Update Targets (#486) 2017-05-26 20:00:12 -04:00
Hao Kung fbf7e1fb72 Add auth reference 2017-05-25 21:56:28 -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 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
Nate McMaster ef7a3514cd Upgrade test framework versions and fix test issues (#453) 2017-05-15 12:50:30 -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 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
moozzyk e691e1cff8 Removing legacy raw format for `send`
Fixes issues #383 and #127
2017-04-18 11:34:43 -07:00
BrennanConroy 9993fd96da Use policy names in EndPointOptions (#340) 2017-04-11 12:35:31 -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
David Fowler 5df022df0c Remove skipped tests and increased timeout for failing test 2017-04-04 22:13:12 -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
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
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
Andrew Stanton-Nurse 1732ac5760 add support for binary format in /poll (#303) 2017-03-16 11:06:26 -07:00
Andrew Stanton-Nurse 0133153bc9 use new protocol for '/send' (#297) 2017-03-15 18:03:23 -07:00
Andrew Stanton-Nurse 78dfd278c1 Integrating new transport protocols (#257) 2017-03-07 10:46:36 -08:00
BrennanConroy 485f9595e2 EndPoint options and injection 2017-03-01 14:38:50 -08:00
BrennanConroy 0abac4a20d Fix null ref in DisposeAsync on ConnectionState 2017-02-28 11:44:25 -08:00
Nate McMaster af5e7da478 Remove workarounds and unify dependency versions 2017-02-23 17:09:07 -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
Pawel Kadluczka 763d115b08 Re-enabling building for net46 after System.Memory packages were fixed (#228) 2017-02-22 09:04:09 -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
Nate McMaster 7e8f92b418 Remove makefile.shade and add npm install to repo.targets
Also, add (commented-out) conditional cross compiling for tests on xplat
2017-02-17 10:07:09 -08:00
moozzyk 607445fc2b Workaround for broken System.Memory package 2017-02-16 12:41:09 -08:00
moozzyk ce4a8f0276 Disabling tests broken by new pipelines 2017-02-16 12:40:23 -08:00
Nate McMaster f684fcb574 Downgrade to stable packages 2017-02-15 14:23:11 -08:00
Andrew Stanton-Nurse a728e1da41 Text Protocol Formatter (#187) 2017-02-14 16:00:51 -08:00
Nate McMaster 7281bf90c0 Upgrade to VS 2017 (#176) 2017-02-02 12:54:23 -08:00
moozzyk c997ea8165 Converting pipelines to channels 2017-01-26 08:04:58 -08: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
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
BrennanConroy aec52670b4 React to Channel API changes 2017-01-19 08:15:59 -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
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