websocket不知什么原因莫名断开 5C
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1167)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1107)
    at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:72)
    at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171)
    at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151)
    at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148)
    at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)




这个说的是把 proxy_read_timeout 修改大一些(默认60s)

看你贴的 我只能看到 io流异常


Csdn user default icon
websocket 如果服务端主动断开连接客户端应该如何收到反馈

如果存在服务器主动断开与客户端连接的websocket的情况, 服务器端或者客户端应该如何写才能让客户端接收到连接被断开连接的反馈? 麻烦定时检测是否断开的这种方法就不要说了。

使用Golang的gorilla / websocket软件包的Websocket连接断开

<div class="post-text" itemprop="text"> <p>I'm attempting to port a NodeJS script that establishes and maintains a Websocket connection to a third-party server to Go using the <a href="https://github.com/gorilla/websocket" rel="nofollow noreferrer">gorilla/websocket</a> package. In the <a href="https://gist.github.com/anonymous/7c169e995d13a943d3f494c88cac7a17" rel="nofollow noreferrer">Node script</a>, a pong is received following a ping, and the connection is kept alive indefinitely. In the <a href="https://gist.github.com/anonymous/69b8dca0172803fccb45dfeb5d310133" rel="nofollow noreferrer">Go script</a>, ping/pong works but the connection is dropped by the server after about 30 seconds. </p> <p>I suspect that the pings that are sent using the Go websocket package are malformed, but I can't pinpoint the cause of this. Comparing the captured, encrypted network traffic while running these programs shows no difference in the response length of the TCP requests and responses, so this may not be the issue. Any help would be greatly appreciated!</p> <p><strong>websocket.js</strong></p> <pre><code>#!/usr/bin/env node // npm install websocket@1.0.25 --save const WebSocketClient = require('websocket').client; const client = new WebSocketClient(); let lastPing = new Date().getTime(); client.on('connectFailed', function(error) { console.log('Connect Error: ' + error.toString()); }); client.on('connect', function(connection) { console.log('Connected to Server...'); connection.on('error', function(error) { console.log("Connection Error: " + error.toString()); }); connection.on('close', function() { console.log('Connection Closed'); }); connection.on('message', function(message) { if (message.type === 'utf8') { console.log(message.utf8Data); } }); connection.on('pong', function(){ console.log('[pingpong] response took', (new Date().getTime() - lastPing) + 'ms'); }) function send(message) { if (connection.connected) { connection.sendUTF(message); } } // Send a ping every 10s // to keep the connection live setInterval(function(){ lastPing = new Date().getTime(); connection.ping(); }, 10000); }); client.connect('wss://ws.radarrelay.com/0x/v0/ws'); </code></pre> <p><strong>websocket.go</strong></p> <pre><code>package main import ( "flag" "log" "os" "os/signal" "time" "github.com/gorilla/websocket" ) var addr = "wss://api.radarrelay.com/0x/v0/ws" func main() { flag.Parse() log.SetFlags(0) timeoutDuration := 2 * time.Minute interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, os.Interrupt) c, _, err := websocket.DefaultDialer.Dial(addr, nil) if err != nil { log.Fatal("dial:", err) } else { log.Println("Connected to server") } c.SetPongHandler(func(str string) error { log.Println("pong received", str) return nil }) defer c.Close() done := make(chan struct{}) go func() { defer c.Close() defer close(done) for { c.SetReadDeadline(time.Now().Add(timeoutDuration)) _, message, err := c.ReadMessage() if err != nil { log.Println("read:", err) return } if len(message) &gt;= 2 { message = message[2:] } log.Printf("recv: %s", message) } }() ticker := time.NewTicker(10 * time.Second) defer ticker.Stop() for { select { case _ = &lt;-ticker.C: err := c.WriteMessage(websocket.PingMessage, []byte{}) if err != nil { log.Println("write:", err) return } else { log.Println("ping sent") } case &lt;-interrupt: log.Println("interrupt") // To cleanly close a connection, a client should send a close // frame and wait for the server to close the connection. err := c.WriteMessage( websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) if err != nil { log.Println("write close:", err) return } select { case &lt;-done: case &lt;-time.After(time.Second): } c.Close() return } } } </code></pre> </div>

一分钟后,Gorilla WebSocket断开连接

<div class="post-text" itemprop="text"> <p>I'm using Go (Golang) 1.4.2 with Gorilla WebSockets behind an nginx 1.4.6 reverse proxy. My WebSockets are disconnecting after about a minute of having the page open. Same behavior occurs on Chrome and Firefox.</p> <p>At first, I had problems connecting the server and client with WebSockets. Then, I read that I needed to tweak my nginx configuration. This is what I have.</p> <pre><code>server { listen 80; server_name example.com; proxy_pass_header Server; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forward-Proto $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass; } } </code></pre> <p>My Go code is basically echoing back the client's message. (Errors omitted for brevity). This is my <code>HandleFunc</code>.</p> <pre><code>var up = websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, } ws, _ := up.Upgrade(resp, req, nil) defer ws.Close() var s struct { Foo string Bar string } for { ws.ReadJSON(&amp;s) ws.WriteJSON(s) } </code></pre> <p>The JavaScript is pretty simple as well.</p> <pre><code>var ws = new WebSocket("ws://example.com/ws/"); ws.addEventListener("message", function(evnt) { console.log(JSON.parse(evnt.data)); }); var s = { Foo: "hello", Bar: "world" }; ws.send(JSON.stringify(s)); </code></pre> <p>Go is reporting <code>websocket: close 1006 unexpected EOF</code>. I know that when I leave or refresh the page <code>ReadJSON</code> returns <code>EOF</code>, but this appears to be a different error. Also, the unexpected EOF happens by itself after about a minute of having the page open.</p> <p>I have an <code>onerror</code> function in JavaScript. That event doesn't fire, but <code>onclose</code> fires instead.</p> </div>


如题... 连接上了之后,过几分钟就会自动断开.. 在多个浏览器测试过...结果都是这样...


<div class="post-text" itemprop="text"> <p>I am sending <code>WebRTC - RTCSessionDescription offer</code> packet to other connected "webrtc" PEER in a socket and as soon as I send RTCSessionDescription offer packet, my WebSocket sends me a signal, I am disconnected and the "<code>RTCSessionDescripotion offer packet</code>" never reaches to other peers.</p> <p>I am using <a href="https://github.com/kataras/iris" rel="nofollow noreferrer">https://github.com/kataras/iris</a> as go framework.</p> <p>Here is my WebSocket configuration:</p> <pre><code>ws := websocket.New(websocket.Config{ ReadBufferSize: 10240, WriteBufferSize: 10240, }) ws.OnConnection(func(c websocket.Connection) { c.On("message", func(message string) { var dataIs map[string]string byteMsg := []byte(message) _ = json.Unmarshal(byteMsg, &amp;dataIs) c.To(dataIs["room"]).Emit("message", dataIs["message"]) }) c.OnDisconnect(func() { c.EmitMessage([]byte("Connection Closed!")) fmt.Println("Closing Connection") ws.Disconnect(c.ID()) }) }) </code></pre> <p>And it prints on loop "Closing Connection" message.</p> <p>I am expecting to see the "message event" being fired back to both peers, but it closes the connection and runs "closing connection" message on a continuous loop.</p> </div>

websocket client执行socket_write 就断开连接

php 充当websocket客户端,模拟向服务器端发消息,但是一执行socket_write连接就丢失了。 是因为php是短连接吗?我在服务端有监控发送的消息,没有收到消息。 代码: $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_connect($socket, '********', ***); echo $result."\n"; echo "Send Command..........\n"; $msg = 'test msg'; socket_write($socket, $msg, strlen($msg)); echo "OK\n"; echo "Reading Backinformatin:\n\n"; while ($out = socket_read($socket, 2048)) { echo $out." out\n"; } echo "Close socket........\n"; //socket_close($socket); echo "OK,He He.\n\n";


<div class="post-text" itemprop="text"> <p>I've created a simple websocket that publishes a JSON stream. I't works fine most of the time except for few cases where I think while looping through the clients to send them message, it gets hung up on a client that is being disconnected abnormally. What measure can I add to this code to mitigate it?</p> <p><strong>Client.go</strong></p> <pre><code>import ( "github.com/gorilla/websocket" ) type client struct { socket *websocket.Conn send chan *Message } func (c *client) read() { defer c.socket.Close() for { _, _, err := c.socket.ReadMessage() if err != nil { log.Info("Websocket: %s", err) break } } } func (c *client) write() { defer c.socket.Close() for msg := range c.send { err := c.socket.WriteJSON(msg) if err != nil { break } } } </code></pre> <p><strong>Stream.go</strong></p> <pre><code>import ( "net/http" "github.com/gorilla/websocket" ) const ( socketBufferSize = 1024 messageBufferSize = 256 ) var upgrader = &amp;websocket.Upgrader{ ReadBufferSize: socketBufferSize, WriteBufferSize: socketBufferSize, } type Stream struct { Send chan *Message join chan *client leave chan *client clients map[*client]bool } func (s *Stream) Run() { for { select { case client := &lt;-s.join: // joining s.clients[client] = true case client := &lt;-s.leave: // leaving delete(s.clients, client) close(client.send) case msg := &lt;-s.Send: // send message to all clients for client := range s.clients { client.send &lt;- msg } } } } func (s *Stream) ServeHTTP(w http.ResponseWriter, res *http.Request) { socket, err := upgrader.Upgrade(w, res, nil) if err != nil { log.Error(err) return } defer func() { socket.Close() }() client := &amp;client{ socket: socket, send: make(chan *Message, messageBufferSize), } s.join &lt;- client defer func() { s.leave &lt;- client }() go client.write() client.read() } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I'm learning WebSocket using PHP library Ratchet. But I have a problem sending the message from client/browser. I have tried using chrome and firefox.</p> <p>The message is not sent to the server until I disconnect the client by closing the tab or refresh the browser.</p> <p>Update: My server use Centos 7 with firewalld enabled.</p> <p>After I close the browser tab, the server output is like this:</p> <pre><code>Connection 73 sending message "tes" to 1 other connection Connection 73 has disconnected </code></pre> <p>Here is the javascript code:</p> <pre><code>conn = new WebSocket('ws://websocket.develop.local:8080'); conn.onopen = function(e) { console.log("Connection established!"); }; conn.onmessage = function(e) { console.log('ada message'); console.log(e.data); }; conn.onerror = function(e) { console.log("WebSocket Error: " , e); //Custom function for handling errors //handleErrors(e); }; function sendMessage(){ var message = document.getElementById("pesan").value; conn.send(message); console.log('Sending message: ' + message); }; </code></pre> <p>And here is the PHP code (I got this from Ratchet docs):</p> <pre><code> &lt;?php namespace MyApp; use Ratchet\MessageComponentInterface; use Ratchet\ConnectionInterface; class Chat implements MessageComponentInterface { protected $clients; public function __construct() { $this-&gt;clients = new \SplObjectStorage; } public function onOpen(ConnectionInterface $conn) { // Store the new connection to send messages to later $this-&gt;clients-&gt;attach($conn); echo "New connection! ({$conn-&gt;resourceId}) "; } public function onMessage(ConnectionInterface $from, $msg) { $numRecv = count($this-&gt;clients) - 1; echo sprintf('Connection %d sending message "%s" to %d other connection%s' . " " , $from-&gt;resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's'); foreach ($this-&gt;clients as $client) { if ($from !== $client) { // The sender is not the receiver, send to each client connected $client-&gt;send($msg); } } } public function onClose(ConnectionInterface $conn) { // The connection is closed, remove it, as we can no longer send it messages $this-&gt;clients-&gt;detach($conn); echo "Connection {$conn-&gt;resourceId} has disconnected "; } public function onError(ConnectionInterface $conn, \Exception $e) { echo "An error has occurred: {$e-&gt;getMessage()} "; $conn-&gt;close(); } } </code></pre> </div>

Websocket over wss://断开连接而没有任何错误

<div class="post-text" itemprop="text"> <p>I am making a webcoket application for my website. Evrything were OK before I tried secured connection. Chrome just disconnects with "undefined" error. Server console shows</p> <blockquote> <p>2014-07-25 15:24:50 [info] [client 5.ХХХ.ХХХ.ХХХ:54166] Connected</p> <p>2014-07-25 15:24:50 [info] [client 5.ХХХ.ХХХ.ХХХ:54166] Disconnected</p> </blockquote> <p>My server is running CentOS 6 with Apache and PHP 5.4. For WS server I choose <a href="https://github.com/lemmingzshadow/php-websocket" rel="nofollow">Link1</a> Certificate also was built for TSL. What I am doing wrong? You can check it out on <a href="https://ws.d1xn.ru/en.php" rel="nofollow">Link2</a></p> </div>

从websocket收到消息时,不会导致“ Websocket:关闭1011”

<div class="post-text" itemprop="text"> <p>I'm trying to subscribe to an event from a client to a server. I can subscribe to the event using JavaScript but when I use <code>Golang</code> and the <code>Gorilla Websocket library</code> I get a</p> <blockquote> <p>'websocket: close 1011 (internal server error)'</p> </blockquote> <p>every time I start a read from the socket.</p> <p>I tried using the <code>/x/websocket</code> library as well but when I tried to read from the socket I end up hanging and I dont get the '1011' error.</p> <p>If I use this JavaScript code on my browser it works:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; var socket = new WebSocket("ws://blehip:blehpport"); function send(data) { socket.send(JSON.stringify(data)); } socket.onopen = function() { send({ action: 'subscribe', auth_token: 'Bleh', request_id: 'Bleh', data: { account_id: 'bleh', binding: "bleh" } }); } socket.onmessage = function(raw_message) { var json_data = JSON.parse(raw_message.data); console.log(json_data); }; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I get a stream of JSON objects in real time.</p> <p>This is my small Golang, Gorilla/Websockets script</p> <pre><code>func main() { var server = flag.String("server", "blehIP:BlehPort", "server address") var wg sync.WaitGroup flag.Parse() url := url.URL { Scheme: "ws", Host: *server, Path: "", } conn, _, err := websocket.DefaultDialer.Dial(url.String(), nil) if err != nil { log.Fatal("Dial Error: ", err) } defer conn.Close() payload := []byte(`{"action":"subscribe",`+ `"auth_token":"` + bleh + `",`+ `"request_id":"` + bleh + `",`+ `"data": {`+ `"account_id":"` + bleh + `",`+ `"binding":"` + bleh + `"}`+ `}`) wg.Add(1) go func() { defer conn.Close() defer wg.Done() err = conn.WriteMessage(websocket.TextMessage, payload) if err != nil { log.Println("Write Error: ", err) return } m := frame{} err := conn.ReadJSON(&amp;m) if err != nil { log.Println("WebScoket closed.", err) return } // msg := string(bytes[:]) fmt.Printf("%v", m) }() wg.Wait() return } </code></pre> <blockquote> <p>The error returned is: WebSocket closed. websocket: close 1011 (internal server error)</p> </blockquote> </div>

Golang Websocket客户端关闭了连接

<div class="post-text" itemprop="text"> <p>I have a golang connection. If the client opened the connection the database change the online column to 1. Here is my code but I didnt implement the last thing. My question, how can I change the database column to 0 if the client closed the connection. How can I track the client, and catch the connection close? </p> <pre><code>package main import ( "golang.org/x/net/websocket" "fmt" "log" "net/http" "strconv" ) type Clients struct { webs *websocket.Conn clientAddr string id int } var ( ActiveClients = make(map[Clients]int) ) func Echo(ws *websocket.Conn){ var err error client := ws.Request().RemoteAddr sockCli := Clients{webs: ws, clientAddr: client, id: 0} ActiveClients[sockCli] = 1 for{ var reply string if err = websocket.Message.Receive(ws, &amp;reply); err != nil{ fmt.Println("Cant receive", err) break }else{ if sockCli.id == 0{ sockCli.id, err = strconv.Atoi(reply) } } if err = websocket.Message.Send(ws, "id:"+strconv.Itoa(sockCli.id)); err != nil{ fmt.Println("Cant send") } for cs, _ := range ActiveClients { if cs.id == 1{ if err = websocket.Message.Send(cs.webs, "asd"); err != nil { // we could not send the message to a peer log.Println("Could not send message to ", cs.clientAddr, err.Error()) } }else { fmt.Println("No") } } } } func main(){ http.Handle("/", websocket.Handler(Echo)) if err := http.ListenAndServe(":1234", nil); err != nil{ log.Fatal("ListenAndServe: ", err) } } </code></pre> </div>

请问H5 WebSocket通信(后台java+tomcat)在页面跳转后断开,怎么解决

最近在做一个在线客服的功能,使用的环境是java+tomcat+jQuery; jdk1.8+tomcat8.0 最用户与客服 对话中;当客服发送一个链接给用户时;用户点击链接时,就直接断掉了链接; 请问如何在点击链接时还保持着通信呢 页面是承载在app上的,所以打开新标签没用!

Golang WebSocket客户端,获取结果后关闭连接

<div class="post-text" itemprop="text"> <p>How I can implement this kind of scenario:</p> <p>1.I have LoginHandler which receives some user data - email and signedXml:</p> <pre><code>func LoginHandler(c *gin.Context) { var ( err error data LoginPost ) if err = c.BindJSON(&amp;data); err != nil { c.JSON(http.StatusBadRequest, gin.H{"status": "error"}) return } ... c.JSON(http.StatusOK, gin.H{"status": "ok"}) } </code></pre> <p>2.I need to send signedXml to another server via websocket</p> <p>3.Save result (success or error)</p> <p>4.Close connection</p> <p>Every HTTP request will open connection, send 1 message, get 1 result and finally close socket. I was trying with channel, but no success. Is this possible to implement my case?</p> <p><strong>UPDATE</strong></p> <pre><code>package main import ( "log" "net/url" "github.com/gorilla/mux" "github.com/gorilla/websocket" "net/http" ) func indexHandler(w http.ResponseWriter, r *http.Request) { message := r.FormValue("message") w.Write([]byte(message)) } func postHandler(w http.ResponseWriter, r *http.Request) { var ( message = r.FormValue("message") u = url.URL{Scheme: "ws", Host: "echo.websocket.org", Path: "/"} err error out []byte conn *websocket.Conn ) log.Printf("message: %s ", message) log.Printf("connecting to %s ", u.String()) conn, _, err = websocket.DefaultDialer.Dial(u.String(), nil) if err != nil { log.Fatal("dial:", err) } log.Println("write") if err = conn.WriteMessage(websocket.TextMessage, []byte(message)); err != nil { log.Fatal("write:", err) } log.Println("read") if _, out, err = conn.ReadMessage(); err != nil { log.Fatal("read:", err) } w.Write(out) log.Println("close") conn.Close() } func main() { r := mux.NewRouter() r.HandleFunc("/", indexHandler).Methods("GET") r.HandleFunc("/post", postHandler).Methods("POST") http.Handle("/", r) http.ListenAndServe(":8080", nil) } </code></pre> </div>

有关python websocket client的问题

js版本上可以收到数据,用的是网上的websocket测试器,发送一个字典指令就可以源源不断收到json格式数据,如图所示: ![图片说明](https://img-ask.csdn.net/upload/201804/08/1523190591_42974.png) 我用python搭建websocket client后控制端却没有回显,如图: ![图片说明](https://img-ask.csdn.net/upload/201804/08/1523190629_114523.png) 请问各位大牛,错误之处在哪,如何用python获取源源不断的json格式数据。

iOS 问为什么SRWebSocket连接服务器就断开连接了。

socket连接服务器ws://**.**.**.**:****直接断开连接,是什么原因?。我只写了连接成功、连接失败、断开连接、收到消息的方法,运行后就到断开连接的方法,在网上测试了一下提示:![图片说明](https://img-ask.csdn.net/upload/201805/28/1527468525_563654.png) 我需要让工程连接成功,是我还缺什么代码吗?


<div class="post-text" itemprop="text"> <p>I'm experimenting with Gorilla WebSocket Package and I would like to know whether there is a way based on the error retrieved from <code>.ReadMessage</code> to determine whether to start the Closing Handshake (ex. 1000 - normal closure) or stop the connection immediately (ex. 1006 - abnormal closure).</p> <p>Currently what I'm doing is to store the list of error codes that I might use to close the websocket connection and if an error code is equals to one of the codes in my list, I do the Closing Handshake. However I'm not sure whether this complies with the WebSocket Spec.</p> <p>Is there another way to do this or this is how it is suppose to be done?</p> </div>

Golang Server关闭客户端的连接:websocket

<div class="post-text" itemprop="text"> <p>i have a problem with my golang server in which i'm using websockets. The server opens the connection and the client could connect to it, but the problem is that when the server starts sending the data to the client, the client connection is closed after a small period of time. i suggest that the problem is with the server and not with the client because i tried to connect to the server with another web client, and it's the same issue. I didn't understand the cause ! Can someone help me?</p> <p>server.go:</p> <pre><code> func Echo(ws *websocket.Conn) { fmt.Println("Echoing") for { msg := MessageReceived{Name: "OrderCommand", Nbmsg: 3} if err := websocket.JSON.Send(ws, msg); err != nil { fmt.Println("Can't send") break } //os.Exit(0) } } func checkError(err error) { if err != nil { Log("Fatal error ", err.Error()) os.Exit(1) } } func main() { http.HandleFunc("/save", saveHandler) http.Handle("/", websocket.Handler(Echo)) err:= http.ListenAndServe(":8081", nil) checkError(err) } </code></pre> <p>and client.go:</p> <pre><code> import ( "code.google.com/p/go.net/websocket" "fmt" "log" ) func main() { origin := "http://localhost/" url := "ws://localhost:8081/echo" ws, err := websocket.Dial(url, "", origin) if err != nil { log.Fatal(err) } var msg = make([]byte, 512) var n int if n, err = ws.Read(msg); err != nil { log.Fatal(err) } fmt.Printf("Received: %s. ", msg[:n]) } </code></pre> </div>


``` var websocket = null; if ('WebSocket' in window) { websocket = new WebSocket("ws://localhost:8080/springws/websocket/socketServer.do"); } else if ('MozWebSocket' in window) { websocket = new MozWebSocket("ws://localhost:8080/springws/websocket/socketServer.do"); } else { websocket = new SockJS("http://localhost:8080/springws/sockjs/socketServer.do"); } websocket.onopen = onOpen; websocket.onmessage = onMessage; websocket.onerror = onError; websocket.onclose = onClose; ``` 一直是监听到error,请问有了解的吗。 电脑端浏览器是正常的,手机浏览器检测有WebSocket

为什么AWS API Gateway Websocket发送错误

<div class="post-text" itemprop="text"> <p>I am using serverless framework to set up an AWS API Gateway websocket which calls a lambda function written in Go. Right now the handler only logs a message. I can connect to the websocket, and I can see the message is logged in Cloudwatch when I send a message through the socket, but I always get an error message that looks like </p> <pre><code>{ "message": "Internal server error", "connectionId": "eU3C1cE7CYcCJPw=", "requestId": "eU3EQFX0iYcFysQ=" } </code></pre> <p>There are no errors logged for the lambda in Cloudwatch. The AWS API Gateway config looks good to me. I'm at a loss trying to think of what could cause this.</p> <p>My main.go:</p> <pre class="lang-golang prettyprint-override"><code>package main import ( "fmt" "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" ) func Handler(request events.APIGatewayWebsocketProxyRequest) { fmt.Println("default function ran") } func main() { lambda.Start(Handler) } </code></pre> <p>Probably not super relevant but the serverless.yaml config:</p> <pre><code>functions: websocket-default: handler: bin/ws events: - websocket: route: $default </code></pre> <p>The payload I'm sending:</p> <pre><code>{ "action": "whatever", "data": "{whatever}" } </code></pre> </div>



定量遥感中文版 梁顺林著 范闻捷译



YOLOv3是一种基于深度学习的端到端实时目标检测方法,以速度快见长。本课程将手把手地教大家使用labelImg标注和使用YOLOv3训练自己的数据集。课程分为三个小项目:足球目标检测(单目标检测)、梅西目标检测(单目标检测)、足球和梅西同时目标检测(两目标检测)。 本课程的YOLOv3使用Darknet,在Ubuntu系统上做项目演示。包括:安装Darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 Darknet是使用C语言实现的轻型开源深度学习框架,依赖少,可移植性好,值得深入探究。 除本课程《YOLOv3目标检测实战:训练自己的数据集》外,本人推出了有关YOLOv3目标检测的系列课程,请持续关注该系列的其它课程视频,包括: 《YOLOv3目标检测实战:交通标志识别》 《YOLOv3目标检测:原理与源码解析》 《YOLOv3目标检测:网络模型改进方法》 敬请关注并选择学习!

sql语句 异常 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your

在我们开发的工程中,有时候会报 [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ------ 这种异常 不用多想,肯定是我们的sql语句出现问题,下面...

浪潮集团 往年的软件类 笔试题 比较详细的哦

浪潮集团 往年的软件类 笔试题 比较详细的哦

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!




董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。


本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。



eclipseme 1.7.9

eclipse 出了新的eclipseme插件,官方有下载,但特慢,我都下了大半天(可能自己网速差)。有急需要的朋友可以下哦。。。

Spring Boot -01- 快速入门篇(图文教程)

Spring Boot -01- 快速入门篇 今天开始不断整理 Spring Boot 2.0 版本学习笔记,大家可以在博客看到我的笔记,然后大家想看视频课程也可以到【慕课网】手机 app,去找【Spring Boot 2.0 深度实践】的课程,令人开心的是,课程完全免费! 什么是 Spring Boot? Spring Boot 是由 Pivotal 团队提供的全新框架。Spring Boot...


本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

最简单的倍频verilog程序(Quartus II)

一个工程文件 几段简单的代码 一个输入一个输出(50Mhz倍频到100Mhz)




这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?







课程亮点: 课程培训详细的笔记以及实例代码,让学员开始掌握设计模式知识点 课程内容: 工厂模式、桥接模式、组合模式、装饰器模式、外观模式、享元模式、原型模型、代理模式、单例模式、适配器模式 策略模式、模板方法模式、观察者模式、迭代器模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式 课程特色: 笔记设计模式,用笔记串连所有知识点,让学员从一点一滴积累,学习过程无压力 笔记标题采用关键字标识法,帮助学员更加容易记住知识点 笔记以超链接形式让知识点关联起来,形式知识体系 采用先概念后实例再应用方式,知识点深入浅出 提供授课内容笔记作为课后复习以及工作备查工具 部分图表(电脑PC端查看):




本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。


本文的面试题如下: Redis 持久化机制 缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级等问题 热点数据和冷数据是什么 Memcache与Redis的区别都有哪些? 单线程的redis为什么这么快 redis的数据类型,以及每种数据类型的使用场景,Redis 内部结构 redis的过期策略以及内存淘汰机制【~】 Redis 为什么是单线程的,优点 如何解决redis的并发竞争key问题 Red...


【超实用课程内容】 本课程演示的是一套基于Java的SSM框架实现的图书管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的java人群。详细介绍了图书管理系统的实现,包括:环境搭建、系统业务、技术实现、项目运行、功能演示、系统扩展等,以通俗易懂的方式,手把手的带你从零开始运行本套图书管理系统,该项目附带全部源码可作为毕设使用。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27513 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化






发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...






CopyOnWriteArrayList.java和ArrayList.java,这2个类的构造函数,注释中有一句话 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public ArrayList(Collection&lt;? ...

相关热词 c#中如何设置提交按钮 c#帮助怎么用 c# 读取合并单元格的值 c#带阻程序 c# 替换span内容 c# rpc c#控制台点阵字输出 c#do while循环 c#调用dll多线程 c#找出两个集合不同的