<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>WebSocket Testing - Swoft 2.0</title>
<link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/icono/1.3.0/icono.min.css" rel="stylesheet">
<style>
/** Large devices (desktops, less than 1200px) */
@media (min-width: 1400px) {
.container {
max-width: 1340px;
}
}
#message-box {
min-height: 410px;
max-height: 600px;
overflow: auto;
}
.text-sm {
font-size: small;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="#">Swoft</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/"><i data-feather="home"></i> Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://github.com/swoft-cloud/swoft"><i data-feather="github"></i>
Github</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://swoft.org/docs"><i data-feather="book"></i> 中文文档</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="http://swoft.io/docs"><i data-feather="book"></i> English Docs</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="my-1">
</div>
<div class="container">
<div class="row">
<div class="col" id="page-head">
<h1 class="py-2 my-4">WebSocket Testing - <small class="font-italic text-muted">Swoft framework 2.0</small></h1>
<hr>
<div class="alert alert-warning alert-dismissible fade" role="alert">
<strong>Warning!</strong> <span class="alert-txt">Hi</span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
</div>
<div class="row">
<div class="col-4">
<div class="card border-info config-box">
<h5 class="card-header"><i data-feather="settings"></i> Configuration</h5>
<div class="card-body">
<div class="card-title">WebSocket Server Address</div>
<div class="input-group mb-3">
<input type="text" id="ws-addr"
class="form-control"
placeholder="websocket server address"
aria-label="websocket server address"
aria-describedby="btn-conn"
value="ws://127.0.0.1:18308/echo"
list="addr-list">
<div class="input-group-append">
<button class="btn btn-outline-primary" type="button" id="btn-conn">
<i data-feather="link"></i>
</button>
</div>
<datalist id="addr-list">
<option value="ws://127.0.0.1:18308/echo">
<option value="ws://127.0.0.1:18308/chat">
<option value="ws://127.0.0.1:18308/test">
<option value="wss://echo.websocket.org/">
</datalist>
</div>
<div>
<p class="bg-light text-info rounded-lg">Please note that the server address, port, path, etc. are correct</p>
</div>
<form action="#">
<div class="form-group">
<label for="input-message">Input Message</label>
<textarea class="form-control" id="input-message" rows="8" minlength="1"></textarea>
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="cfg-clr-after-send">
<label class="form-check-label" for="cfg-clr-after-send">Clear input after send</label>
</div>
</form>
</div>
<div class="card-footer bg-transparent">
<button class="btn btn-sm btn-outline-info float-right" id="btn-sending"><i data-feather="send"></i> Send Message</button>
</div>
</div>
</div>
<div class="col-8">
<div class="card">
<h5 class="card-header text-white bg-primary"><i data-feather="message-square"></i> Messages</h5>
<div class="card-body">
<p class="card-text">websocket message box</p>
<div id="message-box" class="bg-light p-2">
<div class="message-item">
<div class="text-right py-1">
<span class="badge badge-secondary">You</span> at <span class="font-italic text-muted text-sm">2020-1-20 10:54:40</span>
</div>
<div class="clearfix">
<div class="float-right badge badge-success rounded-pill p-2">
<span class="user-message">User send message example</span>
</div>
</div>
</div>
<div class="message-item">
<div class="py-1">
<span class="badge badge-secondary">Server</span> at <span class="font-italic text-muted text-sm">2020-1-20 10:54:40</span>
</div>
<div class="clearfix">
<div class="float-left badge badge-primary rounded-pill p-2">
<span class="server-message">Server reply message example</span>
</div>
</div>
</div>
</div><!-- .message-box -->
</div>
<div class="card-footer bg-transparent">
<div class="clearfix">
<a href="javascript:void(0);" class="btn btn-sm btn-outline-secondary float-right" id="btn-clr-message">
<i data-feather="trash"></i>
Clear Messages
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="py-3">
<hr>
</div>
<div class="footer mt-5 py-2">
<ul class="nav justify-content-center my-3">
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://github.com/swoft-cloud/swoft">Github</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://gitee.com/swoft/swoft">Gitee</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://github.com/swoft-cloud/swoft/issues">Issues</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="http://swoft.io/docs">English Docs</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://swoft.org/docs">中文文档</a>
</li>
</ul>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.slim.min.js"></script>
<script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdn.bootcss.com/feather-icons/4.24.1/feather.min.js"></script>
<script>
// apply icons
feather.replace()
$('.toast').toast()
// ws connection
let ws
const config = {
heartbeat: false,
connected: false,
}
const pgHead = $('#page-head')
const btnConn = $('#btn-conn')
const btnSend = $('#btn-sending')
const btnClr = $('#btn-clr-message')
const inAddr = $('#ws-addr')
const inText = $('#input-message')
const msgBox = $('#message-box')
btnConn.on('click', function (e) {
let addr = inAddr.val()
if (!addr || addr.length < 5) {
show_alert('please input ws server ad
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
首个基于Swoole原生协程的新时代 PHP 高性能协程全栈框架,内置协程网络服务器及常用的协程客户端,常驻内存,不依赖传统的PHP-FPM,全异步非阻塞IO实现,以类似于同步客户端的写法实现异步客户端的使用,没有复杂的异步回调,没有繁琐的 yield, 有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
资源推荐
资源详情
资源评论
收起资源包目录
基于Swoole原生协程新时代PHP高性能协程全栈框架,内置协程网络服务器及常用协程客户端,常驻内存,不依赖传统的PHP-FPM (127个子文件)
big.data 707KB
phpstan.neon.dist 3KB
Dockerfile 3KB
.dockerignore 8B
.env.example 46B
favicon.ico 9KB
start-http-server.jpg 102KB
composer.json 2KB
composer.cn.json 1KB
composer.dev.json 1KB
.keep 0B
.keep 0B
LICENSE 11KB
CONTRIBUTING.md 3KB
ws-test.php 12KB
bean.php 6KB
index.php 5KB
SelectDbController.php 5KB
TestCommand.php 5KB
DbTransactionController.php 4KB
TestController.php 4KB
DbModelController.php 3KB
RedisController.php 3KB
User.php 3KB
SessionController.php 3KB
Count.php 3KB
ValidatorController.php 3KB
TaskController.php 2KB
RpcController.php 2KB
User3.php 2KB
AgentCommand.php 2KB
TimerController.php 2KB
Count2.php 2KB
BreakerLogic.php 2KB
HomeController.php 2KB
DemoController.php 2KB
DomainLimitMiddleware.php 2KB
LimiterController.php 2KB
CoController.php 2KB
RegisterServiceListener.php 2KB
UserServiceV2.php 2KB
HttpExceptionHandler.php 2KB
LogController.php 1KB
BeanController.php 1KB
WsHandshakeExceptionHandler.php 1KB
UserService.php 1KB
HomeController.php 1KB
AlphaDashRule.php 1KB
BreakerController.php 1KB
Count.php 1KB
header.php 1KB
ConsulLogic.php 1KB
TestTask.php 1KB
CacheController.php 1KB
ChatModule.php 1KB
AlphaDash.php 1KB
RpcExceptionHandler.php 1KB
User.php 1KB
CookieController.php 1KB
FavIconMiddleware.php 1KB
MonitorLogic.php 1KB
ExceptionController.php 1KB
ViewController.php 1KB
GlobalWsMiddleware.php 1KB
Worker2Process.php 1KB
DemoMiddleware.php 1KB
ApiExceptionHandler.php 1KB
RpcProvider.php 1KB
WsMessageExceptionHandler.php 1KB
GlobalTcpMiddleware.php 1KB
DemoMiddleware.php 1KB
CustomerValidator.php 1KB
Desc.php 1KB
RequestBeanAspect.php 1KB
CronTask.php 1KB
AlphaDashParser.php 1KB
EchoModule.php 1KB
DeregisterServiceListener.php 1018B
LimiterLogic.php 1007B
Desc.php 1006B
UserInterface.php 1004B
DbSelector.php 1001B
DemoCommand.php 1000B
DbRanListener.php 996B
ServiceMiddleware.php 974B
TestModule.php 969B
TestValidator.php 940B
ModelSavedListener.php 916B
UserSavingListener.php 906B
SyncTask.php 904B
WorkerStartListener.php 902B
WorkerStopListener.php 893B
ShutDownListener.php 883B
StartListener.php 876B
MonitorProcess.php 851B
AutoLoader.php 844B
Application.php 839B
Worker1Process.php 812B
ProcController.php 795B
DbBuilderController.php 793B
共 127 条
- 1
- 2
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6838
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功