- setup wss in haproxy
This commit is contained in:
parent
b774dd9399
commit
5440bdd1a5
@ -607,18 +607,13 @@
|
||||
}
|
||||
**/
|
||||
|
||||
const eb = new vertx.EventBus("http://192.168.246.131:3001/eventbus");
|
||||
const eb = new vertx.EventBus("https://ritz-ss.blindside-dev.com/eventbus");
|
||||
eb.onopen = function () {
|
||||
console.log("FOOOO!!!!!");
|
||||
eb.registerHandler("chat.to.client", function (msg) {
|
||||
console.log("From server: " + msg + "\n");
|
||||
BBB.onMessageFromDS(msg);
|
||||
});
|
||||
|
||||
eb.send("foo-bar", "ValidateAuthToken", function(msg) {
|
||||
console.log("reply: " + msg + "\n");
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
BBB.sendToDeepstream = function(data) {
|
||||
|
44
labs/vertx-akka/nginx/haproxy.cfg
Executable file
44
labs/vertx-akka/nginx/haproxy.cfg
Executable file
@ -0,0 +1,44 @@
|
||||
frontend ssl-in
|
||||
mode tcp
|
||||
log-format %ci:%cp\ [%t]\ %ft\ %b/%s\ %Tw/%Tc/%Tt\ %U:%B\ %ts\ %ac/%fc/%bc/%sc/%rc\ %hr\ %hs\ %sq/%bq
|
||||
|
||||
bind *:443,:::443 ssl crt /etc/ssl/ritz-ss.blindside-dev.com/ritz-ss.blindside-dev.com.pem
|
||||
|
||||
# Detect RTMP traffic
|
||||
# The first byte must be 0x03 (version 3)
|
||||
acl rtmp_handshake_ver req.payload(0,1) -m bin 03
|
||||
|
||||
# RTMP has a fixed-size handshake: 1 byte version + 1536 byte data.
|
||||
# This acl causes haproxy to not detect a request as rtmp unless
|
||||
# it's received at least that much data (and didn't match other things)
|
||||
#acl rtmp_handshake_size req.len ge 1537
|
||||
acl rtmp_handshake_size req.len ge 1
|
||||
|
||||
acl is_websocket path_beg -i /eventbus
|
||||
#acl is_websocket hdr(Upgrade) -i WebSocket
|
||||
|
||||
# haproxy has built-in HTTP detection
|
||||
|
||||
# If we haven't received enough data to identify the protocol after
|
||||
# 30 seconds, drop the connection
|
||||
tcp-request inspect-delay 30s
|
||||
|
||||
tcp-request content accept if rtmp_handshake_ver rtmp_handshake_size
|
||||
tcp-request content accept if HTTP
|
||||
|
||||
use_backend vertx if is_websocket
|
||||
use_backend red5 if rtmp_handshake_ver rtmp_handshake_size
|
||||
use_backend nginx if HTTP
|
||||
|
||||
backend nginx
|
||||
mode http
|
||||
option forwardfor
|
||||
reqadd X-Forwarded-Proto:\ https
|
||||
server nginx 127.0.0.1:80
|
||||
|
||||
backend red5
|
||||
mode tcp
|
||||
server red5 127.0.0.1:1935
|
||||
|
||||
backend vertx
|
||||
server vertx 127.0.0.1:3001
|
76
labs/vertx-akka/src/main/webapp/webroot/chat.html
Executable file
76
labs/vertx-akka/src/main/webapp/webroot/chat.html
Executable file
@ -0,0 +1,76 @@
|
||||
<!--
|
||||
#%L
|
||||
distributed-chat-service
|
||||
%%
|
||||
Copyright (C) 2015 Zanclus Consulting
|
||||
%%
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
#L%
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Distributed Chat Service</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js"></script>
|
||||
<script src="vertxbus.js"></script>
|
||||
<style>
|
||||
.inset {
|
||||
box-shadow: inset 0 0 4px #000000;
|
||||
-moz-box-shadow: inset 0 0 4px #000000;
|
||||
-webkit-box-shadow: inset 0 0 4px #000000;
|
||||
width: 400px;
|
||||
border-width: 4px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
input.inset {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
div.inset {
|
||||
height: 500px;
|
||||
white-space: pre-wrap
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
//var eb = new vertx.EventBus("https://192.168.23.33:3001/eventbus");
|
||||
var eb = new vertx.EventBus("http://192.168.246.131:3001/eventbus");
|
||||
eb.onopen = function () {
|
||||
eb.registerHandler("chat.to.client", function (msg) {
|
||||
$('#chat').append(msg + "\n");
|
||||
});
|
||||
|
||||
eb.send("foo-bar", "ValidateAuthToken", function(msg) {
|
||||
$('#chat').append("reply: " + msg + "\n");
|
||||
});
|
||||
};
|
||||
|
||||
function send(event) {
|
||||
if (event.keyCode == 13 || event.which == 13) {
|
||||
var message = $('#input').val();
|
||||
if (message.length > 0) {
|
||||
console.log($('#input'));
|
||||
eb.publish("chat.to.server", message);
|
||||
$('#input').val("");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div id="chat" class="inset"></div>
|
||||
<input id="input" type="text" onkeydown="send(event)" class="inset">
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user