Documentation ¶
Overview ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func InitBroadcaster()
- func RouteEvent(event models.NodeEvent)
- func ServeWs(w http.ResponseWriter, r *http.Request)
- func StartBroadcaster(websocketPort string, ssl bool, sslParams map[string]string)
- func StartListener(eventSocket string)
- type EventBroadcaster
- type Listener
- type NodeStartEventArgs
Constants ¶
const ( WRITE_WAIT = 10 * time.Second PONG_WAIT = 60 * time.Second PING_PERIOD = (PONG_WAIT * 9) / 10 MAX_MESSAGE_SIZE = 1024 * 1024 )
Let's focus on Client code now
Variables ¶
This section is empty.
Functions ¶
func RouteEvent ¶
func ServeWs ¶
func ServeWs(w http.ResponseWriter, r *http.Request)
serveWs handles websocket requests from the peer.
func StartBroadcaster ¶
Start event broadcaster
func StartListener ¶
func StartListener(eventSocket string)
Types ¶
type EventBroadcaster ¶
type EventBroadcaster struct {
// contains filtered or unexported fields
}
Centralized architecture: A central EventBroadcaster is going to receive all ingoing events and to broadcast them to each connected Client
var (
Broadcaster EventBroadcaster
)
func (*EventBroadcaster) Run ¶
func (Broadcaster *EventBroadcaster) Run()
At the end, we instantiate our EventBroadcaster
type Listener ¶
type Listener int
func (*Listener) PersistNodeEvent ¶
func (*Listener) PushNodeStartEvent ¶
func (l *Listener) PushNodeStartEvent(args *NodeStartEventArgs, ack *bool) error
func (*Listener) PushUnManagedNode ¶
func (l *Listener) PushUnManagedNode(args *NodeStartEventArgs, ack *bool) error