remove the 3rd party socket io example because its API has a breaking-change now and some features are not reproducable to that

Former-commit-id: 8d89947be6a3ee6942d596c15f346c3ed6cf6728
This commit is contained in:
Gerasimos (Makis) Maropoulos 2019-06-07 20:45:00 +03:00
parent af751c7602
commit 9c92952a40
6 changed files with 0 additions and 10396 deletions

View File

@ -482,7 +482,6 @@ The package is designed to work with raw websockets although its API is similar
- [Connection List](websocket/connectionlist/main.go) - [Connection List](websocket/connectionlist/main.go)
- [TLS Enabled](websocket/secure/main.go) - [TLS Enabled](websocket/secure/main.go)
- [Custom Raw Go Client](websocket/custom-go-client/main.go) - [Custom Raw Go Client](websocket/custom-go-client/main.go)
- [Third-Party socket.io](websocket/third-party-socketio/main.go)
> You're free to use your own favourite websockets package if you'd like so. > You're free to use your own favourite websockets package if you'd like so.

View File

@ -435,7 +435,6 @@ iris websocket库依赖于它自己的[包](https://github.com/kataras/iris/tree
- [连接列表](websocket/connectionlist/main.go) - [连接列表](websocket/connectionlist/main.go)
- [TLS支持](websocket/secure/main.go) - [TLS支持](websocket/secure/main.go)
- [自定义原始Go客户端](websocket/custom-go-client/main.go) - [自定义原始Go客户端](websocket/custom-go-client/main.go)
- [第三方socket.io](websocket/third-party-socketio/main.go)
> 如果你愿意你可以自由使用你自己喜欢的websockets包。 > 如果你愿意你可以自由使用你自己喜欢的websockets包。

View File

@ -1,44 +0,0 @@
package main
import (
"github.com/kataras/iris"
"github.com/googollee/go-socket.io"
)
/*
go get -u github.com/googollee/go-socket.io
*/
func main() {
app := iris.New()
server, err := socketio.NewServer(nil)
if err != nil {
app.Logger().Fatal(err)
}
server.On("connection", func(so socketio.Socket) {
app.Logger().Infof("on connection")
so.Join("chat")
so.On("chat message", func(msg string) {
app.Logger().Infof("emit: %v", so.Emit("chat message", msg))
so.BroadcastTo("chat", "chat message", msg)
})
so.On("disconnection", func() {
app.Logger().Infof("on disconnect")
})
})
server.On("error", func(so socketio.Socket, err error) {
app.Logger().Errorf("error: %v", err)
})
// serve the socket.io endpoint.
app.Any("/socket.io/{p:path}", iris.FromStd(server))
// serve the index.html and the javascript libraries at
// http://localhost:8080
app.StaticWeb("/", "./public")
app.Run(iris.Addr("localhost:8080"), iris.WithoutPathCorrection)
}

View File

@ -1,38 +0,0 @@
<!doctype html>
<html>
<head>
<title>Socket.IO chat</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font: 13px Helvetica, Arial; }
form { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; }
form input { border: 0; padding: 10px; width: 90%; margin-right: .5%; }
form button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; }
#messages { list-style-type: none; margin: 0; padding: 0; }
#messages li { padding: 5px 10px; }
#messages li:nth-child(odd) { background: #eee; }
</style>
</head>
<body>
<ul id="messages"></ul>
<form action="">
<input id="m" autocomplete="off" /><button>Send</button>
</form>
<script src="/socket.io-1.3.7.js"></script>
<script src="/jquery-1.11.1.js"></script>
<script>
var socket = io();
$('form').submit(function(){
socket.emit('chat message with ack', $('#m').val(), function(data){
$('#messages').append($('<li>').text('ACK CALLBACK: ' + data));
});
socket.emit('chat message', $('#m').val());
$('#m').val('');
return false;
});
socket.on('chat message', function(msg){
$('#messages').append($('<li>').text(msg));
});
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long