Skip to content

Commit 9f83643

Browse files
committed
Update readme with example
1 parent 0dcc25a commit 9f83643

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
11
# bayeux
2-
Bayeux Client Protocol (as specified by Salesforce Realtime API)
2+
Bayeux Client Protocol implemented in Golang (as specified by Salesforce Realtime API)
3+
4+
# Usage
5+
See `examples/main.go`
6+
```golang
7+
package main
8+
9+
import (
10+
"fmt"
11+
12+
bay "github.com/zph/bayeux"
13+
)
14+
15+
func Example() {
16+
b := bay.Bayeux{}
17+
creds := bay.GetSalesforceCredentials()
18+
c := b.TopicToChannel(creds, "topicName")
19+
for {
20+
select {
21+
case e := <-c:
22+
fmt.Printf("TriggerEvent Received: %+v", e)
23+
}
24+
}
25+
}
26+
27+
func main() {
28+
Example()
29+
}
30+
```
31+
32+
See annotations in code for cases where the Salesforce implementation of Bayeux seems to differ from official spec.
33+
34+
Salesforce documentation on Realtime API: https://resources.docs.salesforce.com/sfdc/pdf/api_streaming.pdf
35+
36+
# Stability
37+
38+
This code or variant thereof has been steadily running in production since Nov 2016.
39+
40+
The API is very new. So only a few functions are exposed publicly and these can be expected to remain stable until 12/2018, pending massive changes to Salesforce API. Reasonable attempts will be made to maintain API past that deadline.

0 commit comments

Comments
 (0)