unosquare / embedio

A tiny, cross-platform, module based web server for .NET
http://unosquare.github.io/embedio
Other
1.46k stars 176 forks source link

Getting Help #498

Closed tiziano-morgia closed 2 years ago

tiziano-morgia commented 3 years ago

Is your feature request related to a problem? Please describe.

Hello, I found you, reading source code of an open source application (they used, of course, an EmbedIO inside) and I'm very happy for that! You saved me a lot of work writing my own local server. Actually I have same doubts and I have not found a place, other this, where I can get help or documentation (I have read samples, source, readme, cookbook). So, sorry if I'm writing here and this is not the right place. My doubts/problems are:

Thanks in advance and sorry for my english, Tiziano.

Describe the solution you'd like

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

rdeago commented 3 years ago

Hello @tiziano-morgia, thanks for using EmbedIO! Sorry for the late answer.

The answer to your first question is rather simple: create an event in your shared class and trigger it every time the property is updated. Then listen to the event in your websocket controller, so you can broadcast the new value when necessary without involving the WebApiController at all.

The CancellationToken you see practically everywhere in EmbedIO modules is triggered when the server stops. If you perform any lengthy operation while handling a request, you should call its IsCancellationRequested method and abort anything you're doing when it returns true - or better, assuming that you handle unmanaged resources properly via using blocks / statements, just call ThrowIfCancellationRequested.

Although questions about SWAN are better asked on its own repository, here's a quick check list in the hope that it might help you:

Finally, we don't have a forum but you can join us on Slack. Although your English is certainly more than good enough, feel free to write a direct message to me on Slack in Italian if you want.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.