Skip to content

Get the user's command. After I use PHP to link the prox request, the loop does not exit. Do you have any good ideas, boss? #695

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

Open
Skobo opened this issue May 30, 2022 · 2 comments

Comments

@Skobo
Copy link

Skobo commented May 30, 2022

Get the user's command. After I use PHP to link the prox request, the loop does not exit. Do you have any good ideas, boss?

for {
conn.HandleCommand()
}

@skoef
Copy link
Contributor

skoef commented May 31, 2022

If you're referring to the example from the README and in fact are using EmptyHandler{}, you should change your code to something like this:

for {
  if err := conn.HandleCommand(); err != nil {
    fmt.Printf("error: %s\n", err)
    break
  }
}

This would give away that any command handled by the EmptyHandler will fail and you should implement your own handler (implementing the Handler interface) to do something with the commands your PHP script sends you. If you already implement your own handler, you should still handle the errors like in my example above to see what is going on.

@Skobo
Copy link
Author

Skobo commented May 31, 2022

boss,thank you very much

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