定制 ekstazi/websocket-common 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ekstazi/websocket-common

Composer 安装命令:

composer require ekstazi/websocket-common

包简介

Base amphp based stream interfaces for client and server websocket implementations

README 文档

README

Base stream interfaces for client and server websocket implementations

Installation

This package can be installed as a Composer dependency.

composer require ekstazi/websocket-common

Requirements

PHP 7.2+

Interfaces

Three interfaces provided

interface Reader extends InputStream

Methods

read(): Promise<string>

Reads data from the stream. Return Promise that resolves with a string when new data is available or null if the stream has closed.

interface Writer extends OutputStream

Constants

const MODE_BINARY = "binary"

Send data as binary frames. This mode used by default.

const MODE_TEXT = 'text'

Send data as utf-8 text frames.

Methods

public function setDefaultMode(string $mode): void

Set default mode to write frames.

public function getDefaultMode(): string

Get current default write mode.

public function write(string $data, string $mode = null): Promise<int>

Write data with specified write mode. By default value Writer::getMode() used. Return promise that resolves with number of bytes written

public function end(string $finalData = "", string $mode = null): Promise

Marks the stream as no longer writable. Optionally writes a final data chunk before. Note that this is not the same as forcefully closing the stream. This method waits for all pending writes to complete before closing the stream. Socket streams implementing this interface should only close the writable side of the stream.

interface Connection extends Reader, Writer

统计信息

  • 总下载量: 32
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固