前端实时通信,从轮询到流式通信SSE与WebSocket
引言:前端的实时通信 在前端开发中,实时通信已是基础能力。本文梳理轮询、WebSocket 与 SSE 的原理、适用场景,核心的是降低延迟、减少开销、提升可靠性。 技术选型速览 | 技术 | 方向 | 延迟 | 复杂度 | 适用场景 | | --------- | ---------- | ---- | ------ | ------------------------ | | 轮询 | 客户端拉取 | 高 | 低 | 简单更新,兼容性要求高 | | 长轮询 | 半双向 | 中 | 中
继续阅读
flutter使用webview https证书过期不显示问题,忽略 SSL 错误
使用 flutter_inappwebview 插件,忽略 SSL 错误,用 onReceivedServerTrustAuthRequest 事件,并为指定请求或所有请求返回 ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED)。 child: InAppWebView( initialUrlRequest: URLRequest( url: Uri.parse("https://self-signed.badssl
继续阅读
html网页打印字体出现模糊的解决方法
在打印报告时 打印出来的文本是模糊的, 不清晰, 解决方案: 设置打印时字体 设置css 字体 @media print { *, *::before, *::after { text-shadow: none !important; box-shadow: none !important; } a:not(.btn) { text-decoration: underline; } abbr[title]
继续阅读
使用parcel初始化前端项目
使用parcel创建前端项目 全局安装 parcel yarn add --dev parcel创建项目、初始化npmmkdir parcel-project && npm init -y创建src目录和 index.html、index.js文件mkdir src && cd $_ && touch index.html index.js添加Package scripts, and source{"...": "...","source": "src/index.html","scripts": {"start": "par
继续阅读