client and server's codes keep same with
https://github.com/astaxie/build-web-application-with-golang/blob/master/ebook/08.2.md ,I open the client with Chrome, server with CMD, and the console said:
onload
index.html:10 WebSocket connection to 'ws://localhost:1234/' failed: Error during WebSocket handshake: Unexpected response code: 403
index.html:12 connection closed (1006)
index.html:19 WebSocket is already in CLOSING or CLOSED state.
No message at server-end.
<F12>-Network-Header:
Request URL:
ws://localhost:1234/
- Request Headers CAUTION: Provisional headers are shown.
Cache-Control:
no-cache
Connection:
Upgrade
Host:
localhost:1234
Origin:
null
Pragma:
no-cache
Sec-WebSocket-Extensions:
permessage-deflate; client_max_window_bits, x-webkit-deflate-frame
Sec-WebSocket-Key:
jE5tbcaUK+vcLJ9rjdr1Fw==
Sec-WebSocket-Version:
13
Upgrade:
websocket
User-Agent:
Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
chrome://net-internals/#events:
7969: SOCKET
ws://localhost:1234/
Start Time: 2014-07-17 13:58:20.672
t=2491386 [st= 0] +SOCKET_ALIVE [dt=12]
--> source_dependency = 7965 (SOCKET_STREAM)
t=2491386 [st= 0] +TCP_CONNECT [dt=1]
--> address_list = ["[::1]:1234","127.0.0.1:1234"]
t=2491386 [st= 0] TCP_CONNECT_ATTEMPT [dt=1]
--> address = "[::1]:1234"
t=2491387 [st= 1] -TCP_CONNECT
--> source_address = "[::1]:51589"
t=2491389 [st= 3] SOCKET_BYTES_SENT
--> byte_count = 420
t=2491398 [st=12] SOCKET_BYTES_RECEIVED
--> byte_count = 26
t=2491398 [st=12] -SOCKET_ALIVE
I don't know how to dea with it. It just couldn't run the same result with the github's. Thx for your help!