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

change return type of subscribtions #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions websockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (c *Client) stompConnect() (*websocket.Conn, error) {
return conn, nil
}

func subscribe(conn *websocket.Conn, msg string, out chan StreamMessage, subID *big.Int, c *Client) (chan StreamMessage, error) {
func subscribe(conn *websocket.Conn, msg string, out chan StreamMessage, subID *big.Int, c *Client) (<-chan StreamMessage, error) {
if err := websocket.Message.Send(conn, msg); err != nil {
return nil, err
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func subscribe(conn *websocket.Conn, msg string, out chan StreamMessage, subID *
}

// SubscribeErrors will return a channel subscribed to error messages
func (c Client) SubscribeErrors() (chan StreamMessage, error) {
func (c Client) SubscribeErrors() (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -210,7 +210,7 @@ func (c Client) SubscribeErrors() (chan StreamMessage, error) {
}

// SubscribeHeight will return a channel subscribed to block heights
func (c Client) SubscribeHeight() (chan StreamMessage, error) {
func (c Client) SubscribeHeight() (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -228,7 +228,7 @@ func (c Client) SubscribeHeight() (chan StreamMessage, error) {

// SubscribeUnconfirmedTX will take an account address and subscribe to all
// unconfirmed transactions at that address
func (c Client) SubscribeUnconfirmedTX(address string) (chan StreamMessage, error) {
func (c Client) SubscribeUnconfirmedTX(address string) (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -247,7 +247,7 @@ func (c Client) SubscribeUnconfirmedTX(address string) (chan StreamMessage, erro

// SubscribeConfirmedTX will take an account address and subscribe to all
// confirmed transactions at that address
func (c Client) SubscribeConfirmedTX(address string) (chan StreamMessage, error) {
func (c Client) SubscribeConfirmedTX(address string) (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -266,7 +266,7 @@ func (c Client) SubscribeConfirmedTX(address string) (chan StreamMessage, error)

// SubscribeRecentTX will take an account address and subscribe to all
// recent transactions at that address
func (c Client) SubscribeRecentTX(address string) (chan StreamMessage, error) {
func (c Client) SubscribeRecentTX(address string) (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -285,7 +285,7 @@ func (c Client) SubscribeRecentTX(address string) (chan StreamMessage, error) {

// SubscribeData will take an account address and subscribe to all
// account data changes at that address
func (c Client) SubscribeData(address string) (chan StreamMessage, error) {
func (c Client) SubscribeData(address string) (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -304,7 +304,7 @@ func (c Client) SubscribeData(address string) (chan StreamMessage, error) {

// SubscribeMoasaicData will take an account address and subscribe to all
// mosaic definition changes for that address
func (c Client) SubscribeMoasaicData(address string) (chan StreamMessage, error) {
func (c Client) SubscribeMoasaicData(address string) (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -323,7 +323,7 @@ func (c Client) SubscribeMoasaicData(address string) (chan StreamMessage, error)

// SubscribeMosaics will take an account address and subscribe to all
// mosaic changes for that address
func (c Client) SubscribeMosaics(address string) (chan StreamMessage, error) {
func (c Client) SubscribeMosaics(address string) (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand All @@ -342,7 +342,7 @@ func (c Client) SubscribeMosaics(address string) (chan StreamMessage, error) {

// SubscribeNamespaces will take an account address and subscribe to all
// namespace changes for that address
func (c Client) SubscribeNamespaces(address string) (chan StreamMessage, error) {
func (c Client) SubscribeNamespaces(address string) (<-chan StreamMessage, error) {
conn, err := c.stompConnect()
if err != nil {
return nil, err
Expand Down