-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54ed41e
commit 36763b2
Showing
8 changed files
with
147 additions
and
88 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,13 @@ | |
package examples | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"fmt" | ||
. "github.com/0x19/goesl" | ||
"runtime" | ||
"strings" | ||
|
||
. "github.com/0x19/goesl" | ||
) | ||
|
||
var ( | ||
|
@@ -24,6 +26,8 @@ var ( | |
// Small client that will first make sure all events are returned as JSON and second, will originate | ||
func main() { | ||
|
||
ctx := context.Background() | ||
|
||
// Boost it as much as it can go ... | ||
runtime.GOMAXPROCS(runtime.NumCPU()) | ||
|
||
|
@@ -41,12 +45,12 @@ func main() { | |
// Remember that this is crutial part in handling incoming messages :) | ||
go client.Handle() | ||
|
||
client.Send("events json ALL") | ||
client.Send(ctx, "events json ALL") | ||
|
||
client.BgApi(fmt.Sprintf("originate %s %s", "sofia/internal/[email protected]", "&socket(192.168.1.2:8084 async full)")) | ||
client.BgApi(ctx, fmt.Sprintf("originate %s %s", "sofia/internal/[email protected]", "&socket(192.168.1.2:8084 async full)")) | ||
|
||
for { | ||
msg, err := client.ReadMessage() | ||
msg, err := client.ReadMessage(ctx) | ||
|
||
if err != nil { | ||
|
||
|
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
Oops, something went wrong.