Exemple #1
0
func (bitverseObserver *BitverseObserver) OnConnected(node *bitverse.EdgeNode, remoteNode *bitverse.RemoteNode) {
	fmt.Println("-> now connected to super node " + remoteNode.Id())

	remoteNode.SendChildrenRequest()

	msgService := node.GetMsgService(serviceId)
	msgService.SendAndGetReply("6a133a1b41f987210559ceb4ed9b1dbf58aec876", "hello", 10, func(err error, reply interface{}) {
		if err == nil {
			fmt.Println("that was a surprise " + reply.(string))
		} else {
			// we will most likely timeout unless node 6a133a1b41f987210559ceb4ed9b1dbf58aec876 is online
			fmt.Println("failed to send message to node with id 6a133a1b41f987210559ceb4ed9b1dbf58aec876")
		}
	})
}