-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use endpoint routing for remoting #289
Comments
We have been discussing this for WebSharper for a while, makes perfect sense. Have you thought of a way to include server-push remoting (using websockets)? |
@granicz A small wrapper for the SignalR client and server libraries would probably be the way to go for this (HotReload already uses them, for example), but I haven't looked into it recently. |
#289 Use endpoint routing for remoting
I have started to use bolero now. However, I am finding that server-based push is a key need for me. I am using bolero to build live dashboards and monitoring systems. I have signalR working with the following wasm-side snippet to create the connection: open Microsoft.AspNetCore.SignalR.Client
...
let subscription (loggerProvider: ILoggerProvider) (navMgr:NavigationManager) (dispatch: _ -> unit) =
let hubConnection =
HubConnectionBuilder()
.AddJsonProtocol(fun o -> SerializationOptions.configureSerialization o.PayloadSerializerOptions)//.Converters.Add (JsonFSharpConverter()))
.WithUrl(navMgr.ToAbsoluteUri("/chartdata"))
.WithAutomaticReconnect()
.ConfigureLogging(fun logging ->
logging.AddProvider(loggerProvider) |> ignore
)
.Build()
hubConnection.On<UI_Update> ("ChartUpdate", dispatch) |> ignore
(hubConnection.StartAsync()) |> Async.AwaitTask |> Async.Start
hubConnection The connection is hosted in a Component to receive pushed data. (note it took a while for me to sort out all the different pieces to make it all work. Many thanks to others!) I would appreciate a more elegant solution and integrated solution. |
I tried using Elmish.Bridge, as it has a .NET client. Unfortunately when I tried to use it, the browser froze. I'm guessing that its direct use of System.Net.WebSockets (as opposed to SignalR.Client) may be the cause. So I guess a more Bolero-centric, SignalR-based solution will be necessary. |
Endpoint routing is released in v0.22. Another issue can be opened to discuss SignalR. |
Remoting currently uses a middleware, and it should be more performant using endpoint routing.
The text was updated successfully, but these errors were encountered: