Upgrading server dependancies (#6984)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e2f4492ead
Коммит
58839cefb5
5
vendor/github.com/gorilla/websocket/examples/chat/client.go
сгенерированный
поставляемый
5
vendor/github.com/gorilla/websocket/examples/chat/client.go
сгенерированный
поставляемый
@@ -129,6 +129,9 @@ func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
client := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}
|
||||
client.hub.register <- client
|
||||
|
||||
// Allow collection of memory referenced by the caller by doing all work in
|
||||
// new goroutines.
|
||||
go client.writePump()
|
||||
client.readPump()
|
||||
go client.readPump()
|
||||
}
|
||||
|
||||
4
vendor/github.com/gorilla/websocket/examples/chat/home.html
сгенерированный
поставляемый
4
vendor/github.com/gorilla/websocket/examples/chat/home.html
сгенерированный
поставляемый
@@ -9,7 +9,7 @@ window.onload = function () {
|
||||
var log = document.getElementById("log");
|
||||
|
||||
function appendLog(item) {
|
||||
var doScroll = log.scrollTop === log.scrollHeight - log.clientHeight;
|
||||
var doScroll = log.scrollTop > log.scrollHeight - log.clientHeight - 1;
|
||||
log.appendChild(item);
|
||||
if (doScroll) {
|
||||
log.scrollTop = log.scrollHeight - log.clientHeight;
|
||||
@@ -29,7 +29,7 @@ window.onload = function () {
|
||||
};
|
||||
|
||||
if (window["WebSocket"]) {
|
||||
conn = new WebSocket("ws://{{$}}/ws");
|
||||
conn = new WebSocket("ws://" + document.location.host + "/ws");
|
||||
conn.onclose = function (evt) {
|
||||
var item = document.createElement("div");
|
||||
item.innerHTML = "<b>Connection closed.</b>";
|
||||
|
||||
5
vendor/github.com/gorilla/websocket/examples/chat/main.go
сгенерированный
поставляемый
5
vendor/github.com/gorilla/websocket/examples/chat/main.go
сгенерированный
поставляемый
@@ -8,11 +8,9 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var addr = flag.String("addr", ":8080", "http service address")
|
||||
var homeTemplate = template.Must(template.ParseFiles("home.html"))
|
||||
|
||||
func serveHome(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println(r.URL)
|
||||
@@ -24,8 +22,7 @@ func serveHome(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "Method not allowed", 405)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
homeTemplate.Execute(w, r.Host)
|
||||
http.ServeFile(w, r, "home.html")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
Ссылка в новой задаче
Block a user