Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
getty
Commits
7da3d842
Commit
7da3d842
authored
Feb 08, 2017
by
AlexStocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add wss test
parent
630edfeb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
5 deletions
+66
-5
addr.js
echo/ws-echo/js-client/addr.js
+2
-2
main.js
echo/ws-echo/js-client/main.js
+1
-1
config.go
echo/ws-echo/server/app/config.go
+5
-0
handler.go
echo/ws-echo/server/app/handler.go
+2
-0
server.go
echo/ws-echo/server/app/server.go
+7
-2
cert.pem
echo/ws-echo/server/profiles/test/cert/cert.pem
+18
-0
key.pem
echo/ws-echo/server/profiles/test/cert/key.pem
+27
-0
config.toml
echo/ws-echo/server/profiles/test/config.toml
+4
-0
No files found.
echo/ws-echo/js-client/addr.js
View file @
7da3d842
var
serverAddress
=
'192.168.8.3:10000'
;
//
var serverAddress = '127.0.0.1:10000';
//
var serverAddress = '192.168.8.3:10000';
var
serverAddress
=
'127.0.0.1:10000'
;
echo/ws-echo/js-client/main.js
View file @
7da3d842
...
...
@@ -40,7 +40,7 @@ $(function() {
var
$chatPage
=
$
(
'.chat.page'
);
// The chatroom page
// var socket = new WebSocket('ws://192.168.35.1:10000/echo');
var
socket
=
new
WebSocket
(
'ws://'
+
serverAddress
+
'/echo'
);
var
socket
=
new
WebSocket
(
'ws
s
://'
+
serverAddress
+
'/echo'
);
// // Setting binaryType to accept received binary as either 'blob' or 'arraybuffer'. In default it is 'blob'.
// socket.binaryType = 'arraybuffer';
// socket.binaryType = ''
...
...
echo/ws-echo/server/app/config.go
View file @
7da3d842
...
...
@@ -69,6 +69,11 @@ type (
FailFastTimeout
string
`default:"5s"`
failFastTimeout
time
.
Duration
// cert
// generate_cert -host ikuernto.com
CertFile
string
KeyFile
string
// session tcp parameters
GettySessionParam
GettySessionParam
`required:"true"`
}
...
...
echo/ws-echo/server/app/handler.go
View file @
7da3d842
...
...
@@ -16,6 +16,7 @@ import (
)
import
(
"fmt"
"github.com/AlexStocks/getty"
log
"github.com/AlexStocks/log4go"
)
...
...
@@ -36,6 +37,7 @@ type MessageHandler struct{}
func
(
this
*
MessageHandler
)
Handle
(
session
getty
.
Session
,
pkg
*
EchoPackage
)
error
{
log
.
Debug
(
"get echo package{%s}"
,
pkg
)
fmt
.
Printf
(
"get echo package{%s}
\n
"
,
pkg
)
return
session
.
WritePkg
(
pkg
)
}
...
...
echo/ws-echo/server/app/server.go
View file @
7da3d842
...
...
@@ -149,8 +149,13 @@ func initServer() {
}
// run server
server
.
RunWSEventLoop
(
newSession
,
pathList
[
idx
])
log
.
Debug
(
"server bind addr{ws://%s/%s} ok!"
,
addr
,
pathList
[
idx
])
if
conf
.
CertFile
!=
""
&&
conf
.
KeyFile
!=
""
{
server
.
RunWSSEventLoop
(
newSession
,
pathList
[
idx
],
conf
.
CertFile
,
conf
.
KeyFile
)
log
.
Debug
(
"server bind addr{wss://%s/%s} ok!"
,
addr
,
pathList
[
idx
])
}
else
{
server
.
RunWSEventLoop
(
newSession
,
pathList
[
idx
])
log
.
Debug
(
"server bind addr{ws://%s/%s} ok!"
,
addr
,
pathList
[
idx
])
}
serverList
=
append
(
serverList
,
server
)
}
}
...
...
echo/ws-echo/server/profiles/test/cert/cert.pem
0 → 100644
View file @
7da3d842
-----BEGIN CERTIFICATE-----
MIIC9TCCAd2gAwIBAgIRANmtP/9kdedbv2KRg4M/wTAwDQYJKoZIhvcNAQELBQAw
EjE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uUyOINS
p58oHkDqqqcaQbugvZeRdQDd+uturOyrPJCj2RZLB1+TXF0y3b3wHWVfoTvvgNUX
EV8NJGIrgs2wd1FnxzyMWAYhxezmo2rR9uMcm0DSjogK9fkCe/UBysQlIyLbtpzK
rac+cJC2cwLVVPEBkv3zUZcCgYAm+1ePF8XzMNGOyqFpGfHgnAvJIMAG6OCOx5Tp
6tJojVsZrt/zhHNLKOgTDleVwZmK3zZ5HhzfQNrujSCB0XegaThjxiEdfo8tqU3M
Q5bnoNDiaFt8y0UykU2dClHp9mCGY3Z0BxMMZhD8vtGCCTaqOYaf4JoUzc67n/k4
8d3CYQKBgGqlG9IKqDbBm35rN9yIFHRXaruFARn6ItfzvC2Ikgb9FruuiMiQf4sm
jI9/tdhEt+qVDL3+n/aH7qY1A4QePVeb2IMeUCaJFWIIl0a5hk3RCDIx1jSDL6IO
Iy5zaZECHcGZVNa983db9edzMuV4kOa60qavd+3SxjT/3fztlNHl
-----END RSA PRIVATE KEY-----
echo/ws-echo/server/profiles/test/config.toml
View file @
7da3d842
...
...
@@ -21,6 +21,10 @@ SessionNumber = 700
# app
FailFastTimeout
=
"3s"
# cert
CertFile
=
"./conf/cert/cert.pem"
KeyFile
=
"./conf/cert/key.pem"
# tcp
[GettySessionParam]
CompressEncoding
=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment