# websockethttp-js **Repository Path**: vesmr/websockethttp-js ## Basic Information - **Project Name**: websockethttp-js - **Description**: websockethttp-js - **Primary Language**: JavaScript - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: https://gitee.com/vesmr/websockethttp - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-04-06 - **Last Updated**: 2022-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # websockethttp-js ### websockethttp 协议的 javascript 支持 > [websockethttp](https://gitee.com/vesmr/websockethttp "https://gitee.com/vesmr/websockethttp") ### 使用 install 命令从仓库加载依赖 ```javascript npm install websockethttp ``` ### [服务端使用](./src/server/index.js "server") ```javascript // ``` ### [客户端使用](./src/client/index.js "client") #### 在 nodejs 环境 ```javascript // ``` #### 在 browser 环境 (Vue OR React) ```javascript import { browser } from 'websockethttp' const br = await browser('ws://127.0.0.1:8080/websockethttp?name=test', 'test-browser') if (br == null){ return } const context = await br.SendMessage('ServerTest', {}, 'Hi, server !') console.log('收到响应信息', context) ``` ### 注意事项 如果你的服务器部署时使用了nginx代理,请不要忘记了配置nginx的websocket的代理支持。 ```text map $http_upgrade $connection_upgrade { default upgrade; '' close; } ```