Class WebSocketController
MVC controller for WebSocket requests
Inherited Members
Namespace: DuetWebServer.Controllers
Assembly: DuetWebServer.dll
Syntax
[ApiController]
[Route("machine")]
public class WebSocketController : ControllerBase
Constructors
WebSocketController(IConfiguration, ILogger<WebSocketController>, IHostApplicationLifetime)
Constructor of a new WebSocket controller
Declaration
public WebSocketController(IConfiguration configuration, ILogger<WebSocketController> logger, IHostApplicationLifetime applicationLifetime)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Configuration of this application |
ILogger<WebSocketController> | logger | Logger instance |
IHostApplicationLifetime | applicationLifetime | Application lifecycle instance |
Methods
Get(string?, ISessionStorage)
WS /machine?sessionKey=XXX Provide WebSocket for continuous model updates. This is primarily used to keep DWC up-to-date
Declaration
[HttpGet]
public Task Get(string? sessionKey, ISessionStorage sessionStorage)
Parameters
Type | Name | Description |
---|---|---|
string | sessionKey | Optional session key for authentication |
ISessionStorage | sessionStorage | Session storage singleton |
Returns
Type | Description |
---|---|
Task | HTTP status code: (101) WebSocket upgrade (400) Bad request (403) Forbidden (500) Generic error (502) Incompatible DCS version (503) DCS is not started |