github.com/oarkflow/sio@v0.0.6/adapter.go (about)

     1  package sio
     2  
     3  type Adapter interface {
     4  	// Init is called as soon as the Adapter is
     5  	// registered using Server.SetMultihomeBackend
     6  	Init()
     7  
     8  	// Shutdown is called immediately after all sockets have
     9  	// been closed
    10  	Shutdown() error
    11  
    12  	// BroadcastToBackend is called everytime a BroadcastMsg is
    13  	// sent by a Socket
    14  	//
    15  	// BroadcastToBackend must be safe for concurrent use by multiple
    16  	// go routines
    17  	BroadcastToBackend(*BroadcastMsg)
    18  
    19  	// RoomcastToBackend is called everytime a RoomMsg is sent
    20  	// by a socket, even if none of this server's sockets are
    21  	// members of that room
    22  	//
    23  	// RoomcastToBackend must be safe for concurrent use by multiple
    24  	// go routines
    25  	RoomcastToBackend(*RoomMsg)
    26  
    27  	// BroadcastFromBackend is called once and only once as a go routine as
    28  	// soon as the Adapter is registered using
    29  	// Server.SetMultihomeBackend
    30  	//
    31  	// b consumes a BroadcastMsg and dispatches
    32  	// it to all sockets on this server
    33  	BroadcastFromBackend(b chan<- *BroadcastMsg)
    34  
    35  	// RoomcastFromBackend is called once and only once as a go routine as
    36  	// soon as the Adapter is registered using
    37  	// Server.SetMultihomeBackend
    38  	//
    39  	// r consumes a RoomMsg and dispatches it to all sockets
    40  	// that are members of the specified room
    41  	RoomcastFromBackend(r chan<- *RoomMsg)
    42  }