SwiftWebServer

public class SwiftWebServer

A server managing connections with client browsers providing a user interface via HTML.

  • Instantiates a SwiftWebServer instance with a root View specifying the user interface which is provided to clients.

    Declaration

    Swift

    public init<ContentView>(contentView: ContentView) where ContentView : View
  • Call this method for the server instance to handle an incoming message from a WebSocket client. SwiftWeb sends user input events which the JavaScript client captures over this connection.

    Declaration

    Swift

    public func handleClientMessage(session: WebSocketSession, message: String)
  • Call this method whenever a new client connects to the WebSocket server you provide.

    Declaration

    Swift

    public func handleClientConnect(session: WebSocketSession)
  • Call this method whenever a client disconnects from your WebSocket server.

    Declaration

    Swift

    public func handleClientDisconnect(session: WebSocketSession)