This section is empty.


This section is empty.


This section is empty.


type Core

type Core interface {
	SyncBook(dex string, base, quote uint32) (*core.BookFeed, error)

    Core specifies the needed methods for Server to operate. Satisfied by *core.Core.

    type Server

    type Server struct {
    	// contains filtered or unexported fields

      Server is a websocket hub that tracks all running websocket clients, allows sending notifications to all of them, and manages per-client order book subscriptions.

      func New

      func New(core Core, log dex.Logger) *Server

        New returns a new websocket Server.

        func (*Server) HandleConnect

        func (s *Server) HandleConnect(ctx context.Context, w http.ResponseWriter, r *http.Request)

          HandleConnect handles the websocket connection request, creating a ws.Connection and a connect thread. Since the http.Request's Context is canceled after ServerHTTP returns, a separate context must be provided to be able to cancel the hijacked connection handler at a later time since this function is not blocking.

          func (*Server) Notify

          func (s *Server) Notify(route string, payload interface{})

            Notify sends a notification to the websocket client.

            func (*Server) Shutdown

            func (s *Server) Shutdown()

              Shutdown gracefully shuts down all connected clients, waiting for them to disconnect and any running goroutines and message handlers to return.

              Source Files