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

如何才能正确获取push事件返回的status? #63

Closed
liqing3369 opened this issue Oct 12, 2019 · 1 comment
Closed

如何才能正确获取push事件返回的status? #63

liqing3369 opened this issue Oct 12, 2019 · 1 comment

Comments

@liqing3369
Copy link

如题,客户端代码:

Cli.RoutePush(new(Push))
// 连接服务端
sess, stat := Cli.Dial(serverUrl)
...

type Push struct {
	tp.PushCtx
}

func (p *Push) Table(msg *vos.TableMsg) *tp.Status {
	if true {
		return tp.NewStatusByCodeText(tp.CodeInternalServerError, "test return error", false)
	}
        return nil
}

服务器端代码:

status := session.Push("/push/table", msg)
logs.Logger.Debug("status value.",zap.Any("status",status)) // 打印得到的是nil值

现在的问题是:为什么服务器端得到的status一直是nil值?求助。

@andeya
Copy link
Owner

andeya commented Oct 16, 2019

符合预期,因为当status为OK状态时,没必要再去new一个对象,调用 status.String() 去打印日志,会返回你想看到的信息。具体的status方法,可以自行查看

@andeya andeya closed this as completed Oct 16, 2019
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

No branches or pull requests

2 participants