This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Node represents a user in the network | |
// toIP is IP address of server to connect to | |
// toPort is Port address of server to connect to | |
// response is value unassignable by user, only read | |
type Node struct { | |
toIP string | |
toPort uint16 | |
response string | |
ws js.Value | |
newTransactionCallback func(string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Connect connects node to remote server via TCP | |
func (nd *Node) Connect() bool { | |
// connect to this socket | |
nd.ws = js.Global().Get("WebSocket").New(fmt.Sprintf("ws://%s:%d/ws", nd.toIP, nd.toPort)) | |
nd.ws.Call("addEventListener", "open", js.FuncOf(func(this js.Value, args []js.Value) interface{} { | |
return nil | |
})) | |
nd.ws.Call("addEventListener", "message", js.FuncOf(func(this js.Value, args []js.Value) interface{} { | |
message := args[0].Get("data").String() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying my Blockstack ID is secured with the address 1DkrieQuUHrV4WZdNYqi1nCk7NVgwhh5V6 https://explorer.blockstack.org/address/1DkrieQuUHrV4WZdNYqi1nCk7NVgwhh5V6 |
OlderNewer