You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
}
`
In JMeter,I have installed the websocket plugin according to the link: https://www.blazemeter.com/blog/jmeter-websocket-samplers-a-practical-guide
When I want to do connect test , I set the configuration items:
Protocol: ws
ServeName Or IP: filled with my server address ipv4
Port:8080
Path: /echo
What did you expect to see?
JMeter show the connection is OK
a expample like:
`Thread Name: setUp Thread Group 1-1
Sample Start: 2017-12-27 09:33:25 CST
Load time: 103
Connect Time: 103
Latency: 0
Size in bytes: 129
Sent bytes:163
Headers size in bytes: 129
Body size in bytes: 0
Sample Count: 1
Error Count: 0
Data type ("text"|"bin"|""):
Response code: 101 Response message: Switching Protocols
At last I solved the problem using the following method:
details in the website: https://stackoverflow.com/questions/19708330/serving-a-websocket-in-go
should disable the Origin check using the code like this:
http.HandleFunc("/echo",
func (w http.ResponseWriter, req *http.Request) {
s := websocket.Server{Handler: websocket.Handler(webHandler)}
s.ServeHTTP(w, req)
});
then the JMeter works OK
XinhongWu
changed the title
x/net: websocket 403 return
x/net: websocket 403 return using JMeter
Dec 27, 2017
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8.3 linux/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build244926751=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
I want to do websocket load test with JMeter.
My server code is as below:
`package main
import (
"golang.org/x/net/websocket"
"fmt"
"log"
"net/http"
)
func echoHandler(ws *websocket.Conn) {
msg := make([]byte, 512)
n, err := ws.Read(msg)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Receive: %s\n", msg[:n])
}
func main() {
http.Handle("/echo", websocket.Handler(echoHandler))
http.Handle("/", http.FileServer(http.Dir(".")))
}
`
In JMeter,I have installed the websocket plugin according to the link:
https://www.blazemeter.com/blog/jmeter-websocket-samplers-a-practical-guide
When I want to do connect test , I set the configuration items:
Protocol: ws
ServeName Or IP: filled with my server address ipv4
Port:8080
Path: /echo
What did you expect to see?
JMeter show the connection is OK
a expample like:
`Thread Name: setUp Thread Group 1-1
Sample Start: 2017-12-27 09:33:25 CST
Load time: 103
Connect Time: 103
Latency: 0
Size in bytes: 129
Sent bytes:163
Headers size in bytes: 129
Body size in bytes: 0
Sample Count: 1
Error Count: 0
Data type ("text"|"bin"|""):
Response code: 101
Response message: Switching Protocols
Response headers:
Connection: Upgrade
Sec-WebSocket-Accept: +76XWcGrVMma7qmH7NbJCldDx1Y=
Upgrade: websocket
SampleResult fields:
ContentType:
DataEncoding: null`
What did you see instead?
Client receive 403 response
`Thread Name: setUp Thread Group 1-1
Sample Start: 2017-12-27 09:43:51 CST
Load time: 11
Connect Time: 0
Latency: 0
Size in bytes: 0
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""):
Response code: 403
Response message: Http Upgrade failed with status code 403
Response headers:
SampleResult fields:
ContentType:
DataEncoding: null`
The text was updated successfully, but these errors were encountered: