mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
save commit 3
This commit is contained in:
parent
91d52e18ac
commit
2b9fd11a2e
@ -151,8 +151,8 @@ func (w Wrapper) Commit(height *int64) (*ctypes.ResultCommit, error) {
|
|||||||
|
|
||||||
// SubscribeWS subscribes for events using the given query and remote address as
|
// SubscribeWS subscribes for events using the given query and remote address as
|
||||||
// a subscriber, but does not verify responses (FIXME)!
|
// a subscriber, but does not verify responses (FIXME)!
|
||||||
func (w Wrapper) SubscribeWS(wsCtx rpctypes.WSRPCContext, query string) (*ctypes.ResultSubscribe, error) {
|
func (w Wrapper) SubscribeWS(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, error) {
|
||||||
out, err := w.Client.Subscribe(context.Background(), wsCtx.GetRemoteAddr(), query)
|
out, err := w.Client.Subscribe(context.Background(), ctx.RemoteAddr(), query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -161,10 +161,10 @@ func (w Wrapper) SubscribeWS(wsCtx rpctypes.WSRPCContext, query string) (*ctypes
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case resultEvent := <-out:
|
case resultEvent := <-out:
|
||||||
wsCtx.TryWriteRPCResponse(
|
ctx.WSConn.TryWriteRPCResponse(
|
||||||
rpctypes.NewRPCSuccessResponse(
|
rpctypes.NewRPCSuccessResponse(
|
||||||
wsCtx.Codec(),
|
ctx.WSConn.Codec(),
|
||||||
rpctypes.JSONRPCStringID(fmt.Sprintf("%v#event", wsCtx.Request.ID)),
|
rpctypes.JSONRPCStringID(fmt.Sprintf("%v#event", ctx.JSONReq.ID)),
|
||||||
resultEvent,
|
resultEvent,
|
||||||
))
|
))
|
||||||
case <-w.Client.Quit():
|
case <-w.Client.Quit():
|
||||||
@ -178,8 +178,8 @@ func (w Wrapper) SubscribeWS(wsCtx rpctypes.WSRPCContext, query string) (*ctypes
|
|||||||
|
|
||||||
// UnsubscribeWS calls original client's Unsubscribe using remote address as a
|
// UnsubscribeWS calls original client's Unsubscribe using remote address as a
|
||||||
// subscriber.
|
// subscriber.
|
||||||
func (w Wrapper) UnsubscribeWS(wsCtx rpctypes.WSRPCContext, query string) (*ctypes.ResultUnsubscribe, error) {
|
func (w Wrapper) UnsubscribeWS(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe, error) {
|
||||||
err := w.Client.Unsubscribe(context.Background(), wsCtx.GetRemoteAddr(), query)
|
err := w.Client.Unsubscribe(context.Background(), ctx.RemoteAddr(), query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -188,8 +188,8 @@ func (w Wrapper) UnsubscribeWS(wsCtx rpctypes.WSRPCContext, query string) (*ctyp
|
|||||||
|
|
||||||
// UnsubscribeAllWS calls original client's UnsubscribeAll using remote address
|
// UnsubscribeAllWS calls original client's UnsubscribeAll using remote address
|
||||||
// as a subscriber.
|
// as a subscriber.
|
||||||
func (w Wrapper) UnsubscribeAllWS(wsCtx rpctypes.WSRPCContext) (*ctypes.ResultUnsubscribe, error) {
|
func (w Wrapper) UnsubscribeAllWS(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error) {
|
||||||
err := w.Client.UnsubscribeAll(context.Background(), wsCtx.GetRemoteAddr())
|
err := w.Client.UnsubscribeAll(context.Background(), ctx.RemoteAddr())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user