func main() { // Print some information fmt.Println("Initializing GopherJS side of bridge...") // Start the initialization sequence controlChannel := ipc.ClientInitialize() // Wait for the initialization message to come from the control channel. // This should indicate that the server is up and running. fmt.Println("Waiting for IPC path...") ipcPath := <-controlChannel // Request that a connection be create fmt.Println("Connecting to IPC path:", ipcPath) connection, err := ipc.DialIPC(ipcPath) if err != nil { fmt.Println("error: IPC connection failed:", err) return } // Pass the connection to the benchmark benchmarkClient(connection) // Close the connection fmt.Println("Closing IPC connection...") err = connection.Close() if err != nil { fmt.Println("error: IPC connection shutdown failed:", err) } }
func main() { // Print some information fmt.Println("GopherJS IPC Bridge Demo") // Parse command line arguments - there should be only one (aside from the // process image name): the name of the socket on which to connect if len(os.Args) != 2 { fmt.Println("invalid arguments") return } // Request that a connection be create fmt.Println("Connecting to IPC path:", os.Args[1]) connection, err := ipc.DialIPC(os.Args[1]) if err != nil { fmt.Println("error: IPC connection failed:", err) return } // Pass the connection to the benchmark benchmarkClient(connection) // Close the connection fmt.Println("Closing IPC connection...") err = connection.Close() if err != nil { fmt.Println("error: IPC connection shutdown failed:", err) } }