Comments (4)
The server-side is correct, if you have the "name" filled, but where's your client-side source code?
from examples.
@kataras thanks for your reply.
The client is JMeter, and the message is sent in the general way.
If the server code is using the origin go websocket, the message from JMeter can be received.
The server code is as below:
`package main
import (
"golang.org/x/net/websocket"
"fmt"
"log"
"net/http"
)
func webHandler(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])
send_msg := "[" + string(msg[:n]) + "]"
m, err := ws.Write([]byte(send_msg))
if err != nil {
log.Fatal(err)
}
fmt.Printf("Send: %s\n", msg[:m])
}
func main() {
http.HandleFunc("/echo",
func (w http.ResponseWriter, req *http.Request) {
s := websocket.Server{Handler: websocket.Handler(webHandler)}
s.ServeHTTP(w, req)
});
err := http.ListenAndServe(":8080", nil)
if err != nil {
panic("ListenAndServe: " + err.Error())
}
}`
Is Iris having the similar function like ws.Read() ?
If so then I can get message under Iris framework
from examples.
There is an example for the golang.org/x/net/websocket
as client-side talks to an Iris websocket server; https://github.com/iris-contrib/examples/blob/master/websocket/custom-go-client/main.go#L47
from examples.
@kataras Thanks very much
I have solved the problem using the golang.org/x/net/websocket as the server.
JMeter can recognize the websocket server using the origin go-websocket.
from examples.
Related Issues (20)
- [Feature Request] Support slog logger handler
- read form example cannot run HOT 1
- Gzip doesn't work HOT 2
- How to print Session value in Template HOT 1
- Flash Session [ Help Needed ] HOT 1
- get with params HOT 2
- why static file can't be packaged HOT 5
- Can we use mvc service in another service? HOT 3
- How can I get test coverage? HOT 1
- "WithoutVersionChecker" is undefined! HOT 2
- "Hello, webAssembly" link in the table of contents is broken HOT 1
- Error with ctx.URLParams()
- write tcp [::1]:8099->[::1]:64820: wsasend: An established connection was aborted by the software in your host machine.
- WebSocket to REST handlers Adapter
- /create and /decode has no function at the example "Glimpse" HOT 1
- html/template: "movie/index.html" is undefined HOT 1
- Potential import collision: import path should be "go.etcd.io/bbolt", not "github.com/etcd-io/bbolt" HOT 4
- httpexpect doesn't work
- How do I set up a header? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from examples.