Documentation ¶
Index ¶
- type NotifyEvent
- type SubServer
- func (s *SubServer) RefreshSubscription(sid string, autoRefresh bool) error
- func (s *SubServer) Start(listenAddr string) error
- func (s *SubServer) Subscribe(serviceURL, sid string, timeoutInSeconds int, autoRefresh bool, sub Subscriber) (string, error)
- func (s *SubServer) Unsubscribe(sid string) error
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NotifyEvent ¶
type NotifyEvent struct { // SID is the unique ID returned to the called when they subscribed to the event SID string // Body is the response from the server, the caller is responsible for parsing it Body string }
NotifyEvent contains information about a notify event instance
type SubServer ¶
type SubServer struct {
// contains filtered or unexported fields
}
SubServer is a upnp subscription server. Do not create directly, you must call NewSubServer to return a working instance of this type
func NewSubServer ¶
func NewSubServer() *SubServer
NewSubServer returns a new an inited SubServer instance
func (*SubServer) RefreshSubscription ¶
RefreshSubscription refreshes the subscription to the service.
func (*SubServer) Start ¶
Start starts a web server at the specified address which listens for upnp NOTIFY events. listenAddr is the address the upnp type uses to listen for notifications as the callback to the SUBSCRIBE call. e.g. 192.168.0.9:9000
func (*SubServer) Subscribe ¶
func (s *SubServer) Subscribe(serviceURL, sid string, timeoutInSeconds int, autoRefresh bool, sub Subscriber) (string, error)
Subscribe signs up to receive events when there are new NOTIFY messages from the device. The function returns the SID returned by the device, once it has been successfully subscribed to. You will need to keep the SID to unsubscribe.
func (*SubServer) Unsubscribe ¶
Unsubscribe unsubscribes from the events associated with the specified sid
type Subscriber ¶
type Subscriber interface {
UPNPNotify(e NotifyEvent)
}
Subscriber is an interface for types that want to get events from a device