echowsserver

package
v0.0.0-...-f682b98 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

This package contains the implementation of a simple echo websocket

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EchoWebsocketServer

type EchoWebsocketServer struct {
	// contains filtered or unexported fields
}

Structure for the websocket server

func NewEchoWebsocketServer

func NewEchoWebsocketServer(httpServer *http.Server, logger *log.Logger) *EchoWebsocketServer

Description

Factory which creates a new, non-started EchoWebsocketServer.

Inputs

  • httpServer: The underlying HTTP Server to use. The provided HTTP Server handler will be overriden with this server handler. If nil is provided, a default HTTP server listening on localhost:8080 will be used.

  • logger: Logger to use. If nil, default logger will be used

Returns

A new, non-started EchoWebsocketServer or an error if any has occured.

func (*EchoWebsocketServer) ServeHTTP

func (srv *EchoWebsocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

Description

Server handler which accepts incoming websocket connections.

func (*EchoWebsocketServer) Start

func (srv *EchoWebsocketServer) Start() error

Description

Start the websocket server that will accept incoming websocket connections.

func (*EchoWebsocketServer) Stop

func (srv *EchoWebsocketServer) Stop() error

Description

Stop the websocket server

Returns

Nil in case of success, an error otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL