Closed Kaliumhexacyanoferrat closed 2 weeks ago
This would be quite helpful to have
Websockets, along with form-based authentication, are the next topics on the agenda.
Due to my parental leave in summer, there will be few changes from my side in the next months. Pull requests or preparatory changes are of course always welcome.
Would it also be possible to render a page without any theming? Basically increment some data then view page
On Wed, May 4, 2022, 3:30 AM Andreas Nägeli @.***> wrote:
Websockets, along with form-based authentication, are the next topics on the agenda.
Due to my parental leave in summer, there will be few changes from my side in the next months. Pull requests or preparatory changes are of course always welcome.
— Reply to this email directly, view it on GitHub https://github.com/Kaliumhexacyanoferrat/GenHTTP/issues/82#issuecomment-1117007708, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTBPP7KTHBSJ755RAWXKVTVIIRSLANCNFSM4QTZJ52Q . You are receiving this because you commented.Message ID: @.***>
If you would like to use the Website
module, you will need a theme - an empty theme should not be much effort. If you do not need the features provided by the Website
, you can just render a Page
in the default server theme:
var page = Page.From("My Content") // or ModScriban.Page() or ModRazor.Page() or Placeholders.Page()
.Title("My Title")
.Description("My description");
var layout = Layout.Create()
.Add("page", page); // http://localhost:8080/page
Host.Create()
.Handler(layout)
.Defaults()
.Development()
.Console()
.Run();
Razor
and Scriban
allow you to render a model into a template (e.g. read from the file system).
Or, if you are fine with plain text, even easier:
var handler = Inline.Create()
.Get("/page", () => "Hello World!");
Host.Create()
.Handler(handler)
.Run();
How about the websocket module, is it ready for use?
Are there still plans to include this feature?
Yes, web sockets are one of the more important features but as the protocol is rather complex that will take some effort to be implemented.
Notes: Probably do not implement this ourselves but reuse an existing library and just pass the server socket together with some glue code for upgrading the connection. Need to check whether this is possible in one of the suspects.
Will be available with GenHTTP version 9 in November.
As a developer of a reactive, rich client-application, I would like to use websocket connections to the webserver, so that I can easily push content from the server to the clients.
Example
Very vague - clarity comes with implementation.
Acceptance criteria
Websocket
handler is a regularIHandler
that can be added where requiredGenHTTP.Modules.Websocket
module, with a minimal hook into the server core to gain control over the socket