Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty options #134

Merged
merged 1 commit into from
Dec 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ type EventHandler func(args []interface{}, kwargs map[string]interface{})

// Subscribe registers the EventHandler to be called for every message in the provided topic.
func (c *Client) Subscribe(topic string, options map[string]interface{}, fn EventHandler) error {
if options == nil {
options = make(map[string]interface{})
}
id := NewID()
c.registerListener(id)
sub := &Subscribe{
Expand Down Expand Up @@ -575,6 +578,9 @@ func (c *Client) Unregister(procedure string) error {

// Publish publishes an EVENT to all subscribed peers.
func (c *Client) Publish(topic string, options map[string]interface{}, args []interface{}, kwargs map[string]interface{}) error {
if options == nil {
options = make(map[string]interface{})
}
return c.Send(&Publish{
Request: NewID(),
Options: options,
Expand Down