An open-source Go OpenID Shared Signals Framework Receiver.
To use this receiver:
simply add the following lines to your Go files:
import {
"github.com/sgnl-ai/caep.dev-receiver/pkg"
"github.com/sgnl-ai/caep.dev-receiver/pkg/ssf_events"
}
// Configure the receiver (do not specify poll callback if polling is not required yet)
receiverConfig := pkg.ReceiverConfig{
TransmitterUrl: "<your transmitter url here>",
TransmitterPollUrl: "<your transmitter poll url here>",
EventsRequested: []events.EventType{0},
AuthorizationToken: "<your access token here>",
PollCallback: nil, // no polling
}
// Initialize the receiver but do not start polling
receiver, err := pkg.ConfigureSsfReceiver(receiverConfig)
if err != nil {
print(err)
}
events, err := receiver.PollEvents()
if err != nil {
print(err)
}
Use the struct SsfEvent
to parse events that you receive. For example:
fmt.Printf("Subject Format: %v\n", event.GetSubjectFormat())
fmt.Printf("Subject: %v\n", event.GetSubject())
fmt.Printf("Timestamp: %d\n", event.GetTimestamp())
You can also configure the Receiver to periodically poll the Transmitter.