Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (67 sloc) 2.39 KB
@{
ViewData["Title"] = "WebSocket Tester";
ViewData["Des"] = "Test your WebSocket server and connection online.";
Layout = "../Home/_Layout";
}
<div class="jumbotron">
<div class="container">
<h3>WebSocket Tester</h3>
<p>@ViewData["Des"]</p>
<div class="btn-group" role="group">
<a class="btn btn-primary btn-lg" href="https://github.com/AiursoftWeb/Nexus/blob/master/Developer/Views/Tools/WebSocket.cshtml" target="_blank" role="button">
<i class="fa fa-github"></i>
View it on github
</a>
</div>
</div>
</div>
<div class="container">
<div class="col-lg-12 col-md-12">
<div class="card mb-5 mt-4">
<div class="card-header">
<i class="fa fa-network"></i>
Test your connection
</div>
<div class="card-body">
<div class="col-md-6">
<h4>Use your WebSocket server address to connect.</h4>
<hr />
<div class="form-group">
<label>WS Address</label>
<input placeholder="wss://" type="url" id="id" class="form-control" />
</div>
<div class="form-group">
<button class="btn btn-success" onclick="trigger()">Connect</button>
</div>
<kdb id="spanStatus" class="text-danger">Waiting</kdb>
</div>
<div class="col-md-6">
<div id="message"></div>
</div>
</div>
</div>
</div>
</div>
@section js{
<script>
var connect = function (address) {
var target = address;
var webSocket = new WebSocket(target);
webSocket.onopen = function () {
$("#spanStatus").text("Connected to " + target);
};
webSocket.onmessage = function (evt) {
$("#message").append('<p>' + evt.data + '</p>');
};
webSocket.onerror = function (evt) {
alert('Can not connect!');
};
webSocket.onclose = function () {
$("#spanStatus").text("Disconnected!");
};
};
var trigger = function () {
connect($('#id').val(), $('#key').val());
}
</script>
}
You can’t perform that action at this time.