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

add event support #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

add event support #26

wants to merge 2 commits into from

Conversation

zhangxuelai
Copy link

add event support

for example

conn, err := grpc.Dial("127.0.0.1:37101", grpc.WithInsecure(), grpc.WithMaxMsgSize(64<<20-1))
    if err != nil {
        fmt.Println(err.Error())
    }

    eventClient := pb.NewEventServiceClient(conn)
    filter := &pb.BlockFilter{
        Bcname: "xuper",
    }

    buf, _ := proto.Marshal(filter)
    request := &pb.SubscribeRequest{
        Type:   pb.SubscribeType_BLOCK,
        Filter: buf,
    }

    stream, err := eventClient.Subscribe(context.Background(), request)
    if err != nil {
        fmt.Print(err.Error())
    }

    for {
        event, err := stream.Recv()
        if err == io.EOF {
            fmt.Print(err.Error())
        }

        if err != nil {
            fmt.Print(err.Error())
        }
        fmt.Print(string(event.Payload))   
 }

@zhangxuelai
Copy link
Author

@qizheng09

@zhangxuelai
Copy link
Author

@yucaowang

@CLAassistant
Copy link

CLAassistant commented Sep 18, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants