// PollTransactions calls the callback for each WS event received. On error, the
// callback may be called twice.
PollTransactions calls the callback for each WS event received. On error, the
callback may be called twice.
// PollTransactions calls the callback for each WS event received . On error the // callback may be called twice .
func (c *Client) PollTransactions() (func(), error) {
	return c.pollWS(RouteWSTransactions, func(v *fastjson.Value) {
		var err error
		for _, o := range v.GetArray() {
			if err := checkMod(o, "tx"); err != nil {
				if c.OnError != nil {
					c.OnError(err)
				}
				continue
			}
			switch ev := jsonString(o, "event"); {
			case ev == "applied":
				err = parseTxApplied(c, o)
			case ev == "gossip" && jsonString(o, "level") == "error":
				err = parseTxGossipError(c, o)
			case ev == "failed":
				err = parseTxFailed(c, o)
			default:
				err = errInvalidEvent(o, ev)
			}
			if err != nil {
				if c.OnError != nil {
					c.OnError(err)
				}
			}
		}
	})
}
func ( c * Client ) PollTransactions ( ) ( func ( ) , error ) { return c . pollWS ( RouteWSTransactions , func ( v * fastjson . Value ) { var err error for _ , o := range v . GetArray ( ) { if err := checkMod ( o , " " ) ; err != nil { if c . OnError != nil { c . OnError ( err ) } continue } switch ev := jsonString ( o , " " ) ; { case ev == " " : err = parseTxApplied ( c , o ) case ev == " " && jsonString ( o , " " ) == " " : err = parseTxGossipError ( c , o ) case ev == " " : err = parseTxFailed ( c , o ) default : err = errInvalidEvent ( o , ev ) } if err != nil { if c . OnError != nil { c . OnError ( err ) } } } } ) }
PollTransactions calls the callback for each WS event received.
PollTransactions calls the callback for each WS event received .