Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecordStream ¶
RecordStream write the given stream to file. It returns the stream for further uses.
func StreamToWSClients ¶
StreamToWSClients waits for clients to connect and relays the given stream to connected websocket clients. If a client disconnects, it does no longer receives the stream.
Types ¶
type StreamServer ¶
type StreamServer struct { InputStream chan *[]byte Secret string Port string // contains filtered or unexported fields }
StreamServer represents a server, ready to access a single input stream. To create a new instance use s := newStreamServer(":8080", "MySecret") Before using the server, you need to call s.routes() to configure the routes. To shutdown the server use s.shutdown()
func NewStreamServer ¶
func NewStreamServer(port string, secret string) *StreamServer
NewStreamServer creates new instance of stream server. It is regsitered on the given port and access to stream is protected by given secret.
func (*StreamServer) ListenAndServe ¶
func (s *StreamServer) ListenAndServe()
ListenAndServe starts listening for new stream.
func (*StreamServer) Routes ¶
func (s *StreamServer) Routes()
Routes registers function handler for this SteamServer.
type WsClient ¶
type WsClient struct {
// contains filtered or unexported fields
}
WsClient represents a write-only connection to connected websocket.
type WsServer ¶
type WsServer struct { IncomingClients chan *WsClient Port string // contains filtered or unexported fields }
WsServer waits for websocket clients to connect.
func NewWebSocketServer ¶
NewWebSocketServer creates new server to await websocket connections.
func (*WsServer) ListenAndServe ¶
func (s *WsServer) ListenAndServe()
ListenAndServe starts listening for new websocket connections.