Websocket Handshake failure - websocket

From a Ubuntu1604 client, I get this error connecting to my server
Could not connect websocket ws://url err Websocket Handshake failed: Invalid Sec-Websocket-Accept
(expected W2+GvfwqcjuEddB+7s+0XX2qJSo= got nil)
I don't see this error from a RHEL7.5 client. So, I dont think its a server issue. What am I missing on the Ubuntu?

Related

server error: rpc error: code = Unavailable desc = transport is closing" in gRPC

I have a grpc server and a client (in my blog project). when I run the server, It seems everything is ok, when I run the client, I face this error, and both server and client close.
rpc error: code = Unavailable desc = transport is closing
I think error is related to this piece of code:
func newPost(c proto_blog.BlogServiceClient) {
fmt.Println("Starting to do a Unary RPC")
req := &proto_blog.ReqNewPost{
Title: "How can we make an gRPC server?",
Content: "First You have to.....\nAt the end, you have to....",
Author: "Arsham Ahora",
Date: fmt.Sprint(time.Now()),
}
res, err := c.NewPost(context.Background(), req)
if err != nil {
log.Fatalf("Error calling greet server: %v", err)
}
log.Printf("Response from Greet: %v", res.Id)
}
** I noticed this error is not related to whether you have Unary or Streaming.
I want to list some possible reasons cause code = Unavailable desc = transport is closing on gRPC per gRPC faq, in case of someone meets those reasons.
This error means the connection the RPC is using was closed, and there are many possible reasons, including:
mis-configured transport credentials, connection failed on handshaking
bytes disrupted, possibly by a proxy in between
server shutdown
Keepalive parameters caused connection shutdown, for example if you have configured your server to terminate connections regularly to trigger DNS lookups. If this is the case, you may want to increase your MaxConnectionAgeGrace, to allow longer RPC calls to finish.
It can be tricky to debug this because the error happens on the client side but the root cause of the connection being closed is on the server side. Turn on logging on both client and server, and see if there are any transport errors.
The default logger is controlled by environment variables. Turn everything on like this:
$ export GRPC_GO_LOG_VERBOSITY_LEVEL=99
$ export GRPC_GO_LOG_SEVERITY_LEVEL=info
I found that in server code I have a code like this before returning the response:
log.Fatalf("Error happend: %v", e)
And I changed my code like this:
if e != nil {
log.Fatalf("Error happend: %v", e)
}
That error has not occurred but log.Fatalf() has broken my app.
For more details, it was not an error directly from the grpc part, it was because my app broke before returning any response to the gRPC client.
I think you sent wrong piece of code, anyway, As the error was said: "transport is closing" your connection is closed, You have to find where in your server you are exiting your server and handle that.

504 Gateway Time-out on GRPC

I am learning rpc&grpc and go now, i was confused by the grpc.
When I was learning the examples on GitHub(https://github.com/grpc/grpc-go/tree/master/examples), I encountered some problems. In server, i use address = "ip:50051" instead of address = ":50051"(ip is my intranet ip), and in client i use address = "ip:50051" instead of address= "localhost:50051", then run the server and the client, in client i get the error:
rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing failed to do connect handshake, response: \"HTTP/1.0 504 Gateway Time-out\\r\\nConnection: close
But when i learn rpc in golang, use my intranet ip in the server and client, it is ok.
So i want to know why it is wrong in the grpc?
It seems the client failed to on proxy (failed to do a HTTP Connect handshake).
If you have proxy enabled in your system (the proxy environment variable, HTTP_PROXY or HTTPS_PROXY, is set), make sure the proxy works.
If you don't need proxy, clear the env variables and try again.

wstransport.js:218 WebSocket connection to 'wss://chunderw-vpc-gll.twilio.com/signal' failed: Unknown reason

I'm getting this error while integrating Twilio task router. on localhost, so I thought might be its https error so I tried through Heroku but still getting the same error.

Google Cloud Endpoints Sample for Go using gRPC response service fail

I am new using cloud platform. I trying to deploy a service using go and grpc. I found this tutorial https://github.com/GoogleCloudPlatform/golang-samples/tree/master/endpoints/getting-started-grpc and everything was complete successful until I have to call the service.
In the moment that I use the client to call the service I get this error:
could not greet: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp 35.199.74.154:80: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because
connected host has failed to respond.
I would like to know if someone can help me with that problem.

Using wrong WebSocket protocol returns an "unexpected EOF" error in gorilla/websocket/client.go's Dial function

I was trying to connect to a server in Go by using gorilla/websocket
and I kept getting the error "unexpected EOF". It took me way too long to find out it was because I needed to use the secure WebSocket protocol to connect to that server ("wss://" instead of "ws://" in my url).
How can I verify that I'm using the wrong protocol for a given endpoint so that I can log a helpful error message instead of "unexpected EOF"?

Resources