Table of Contents

Class WebSocketController

Namespace
DuetWebServer.Controllers
Assembly
DuetWebServer.dll

MVC controller for WebSocket requests

[ApiController]
[Route("machine")]
public class WebSocketController : ControllerBase
Inheritance
WebSocketController
Inherited Members

Constructors

WebSocketController(IConfiguration, ILogger<WebSocketController>, IHostApplicationLifetime)

MVC controller for WebSocket requests

public WebSocketController(IConfiguration configuration, ILogger<WebSocketController> logger, IHostApplicationLifetime applicationLifetime)

Parameters

configuration IConfiguration

Configuration of this application

logger ILogger<WebSocketController>

Logger instance

applicationLifetime IHostApplicationLifetime

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

[HttpGet]
public Task Get(string? sessionKey, ISessionStorage sessionStorage)

Parameters

sessionKey string

Optional session key for authentication

sessionStorage ISessionStorage

Session storage singleton

Returns

Task

HTTP status code: (101) WebSocket upgrade (400) Bad request (403) Forbidden (500) Generic error (502) Incompatible DCS version (503) DCS is not started