ToolFk is a free test kit that programmers use online. ToolFk focuses on the tools that programmers use every day. You don’t need to install any software, just paste the content and press the execute button to get the results you want. ToolFk also supports BarCode BarCode generation online, QueryList collector, PHP code running online, PHP obfuscation, encryption, decryption, Python code online running, JavaScript online running, YAML Formatting Tool, HTTP simulation query tool, HTML online toolbox, JavaScript online toolbox, CSS online toolbox, JSON online toolbox, Unixtime timestamp conversion, Base64/URL/N Ative2Ascii conversion, CSV conversion toolbox, XML online toolbox, WebSocket online tool, Markdown online toolbox, Htaccess2nginx Conversion, base online conversion, online encryption toolbox, online pseudo-original tool, online APK decompile, online webpage screenshot tool, online random password generation, online Qrcode Qrcode generation, online Crontab expression generation, online short url generation, online calculator tool. Such as more than 20 daily programmer development tools, is a very comprehensive programmer toolbox site.
Site name: ToolFk Site Link: www.toolfk.com/ Tool link: www.toolfk.com/tool-online…
The code of teaching
This tool [online WebScoket test tool] is implemented using JavaScript code. The website page is as follows
STEP 1
STEP 2
The core code is as follows
function StartWebSocket(wsUri) {
websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) { onOpen(evt) };
websocket.onclose = function(evt) { onClose(evt) };
websocket.onmessage = function(evt) { onMessage(evt) };
websocket.onerror = function(evt) { onError(evt) }; }
function onOpen(evt) {
writeToScreen("<span style='color:red'>@lang('toolfk.lang_text_connect_suc')</span>");
}
function onClose(evt) {
writeToScreen("<span style='color:red'>@lang('toolfk.lang_text_connect_close')</span>");
websocket.close();
}
function onMessage(evt) {
writeToScreen('<span style="color:blue">@lang('toolfk.lang_text_server_rep') '+formatDate(new Date())+'</span><br/><span class="bubble">'+ evt.data+'</span>');
}
function onError(evt) {
writeToScreen('@lang('toolfk.lang_text_send_error'):</span> '+ evt.data);
}
function formatDate(now) {
var year=now.getFullYear();
var month=now.getMonth()+1;
var date=now.getDate();
var hour=now.getHours();
var minute=now.getMinutes();
var second=now.getSeconds();
return year+"-"+(month=month<10? ("0"+month):month)+"-"+(date=date<10? ("0"+date):date)+""+(hour=hour<10? ("0"+hour):hour)+":"+(minute=minute<10? ("0"+minute):minute)+":"+(second=second<10? ("0"+second):second);
}
function writeToScreen(message) {
var div = "<div class='newmessage'>"+message+"</div>";
var d = $("#output");
var d=d[0];
var doScroll = d.scrollTop == d.scrollHeight - d.clientHeight;
$("#output").append(div);
if (doScroll) { d.scrollTop = d.scrollHeight - d.clientHeight; }} $(function(){
$(".btn-open").click(function(){
var wsaddr = $("#wsaddr").val();
if (wsaddr==' ') {
layer.msg("@lang('toolfk.lang_text_websocket_empty')");
return false;
}
StartWebSocket(wsaddr);
});
$(".btn-close").click(function(){
websocket.close();
});
$(".btn-clear").click(function(){
$("#wsaddr").val("");
$("#output").empty();
});
$(".btn-demo").click(function(){
$("#wsaddr").val($(this).data("url"));
});
$(".btn-send").click(function(){
var message=$("#message").val();
if (message==' ') {
layer.msg("@lang('toolfk.lang_text_send_address')");
$("#message").focus();
return false;
}
if (typeof websocket==="undefined"){
layer.msg("@lang('toolfk.lang_text_send_fail')");
return false;
}
if (websocket.readyState==3) {
layer.msg("@lang('toolfk.lang_text_close_suc')");
return false;
}
$("#message").val(' ');
writeToScreen('<span style="color:green">@lang('toolfk.lang_text_send_info_ok') '+formatDate(new Date())+'</span><br/>'+ message); websocket.send(message); })});Copy the code
Three reasons it’s worth a try:
-
Integrate a variety of development test tools commonly used in programmer development.
-
Simple and beautiful atmosphere of the website page
-
Support online formatting execution code, APK online decompilation, online high-strength password generation, online web page screenshots and more than 20 tool services
-
Also recommend its sister network www.videofk.com video download toolbox
This paper links: www.hihubs.com/article/373