Skip to content

Instantly share code, notes, and snippets.

@ehsun7b
Created October 21, 2018 19:25
Show Gist options
  • Save ehsun7b/479279f0f20e999f8e3a0dc6b762066c to your computer and use it in GitHub Desktop.
Save ehsun7b/479279f0f20e999f8e3a0dc6b762066c to your computer and use it in GitHub Desktop.
func (s *Server) SignOut(request string, response *string) error {
if request == "" {
*response = "empty request. sign out failed"
} else {
if s.clients == nil {
*response = "you are not signed in"
} else if _, ok := s.clients[request]; !ok {
*response = "you are not signed in"
} else {
delete(s.clients, request)
*response = "signed out successfully"
log.Printf("%v signed out. Clients: %v", request, s.clients)
}
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment