File tree Expand file tree Collapse file tree 4 files changed +8
-3
lines changed Expand file tree Collapse file tree 4 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 33## v0.2.4
44
55- feat(connection): added option ` forceNewConnection ` for connection creation.
6+ - feat(connection): allow sending ` Buffer ` in ` writeText ` method.
67
78## v0.2.3
89
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ function writeLog(msg: string): void {
3838
3939 cli . setMasking ( false ) ;
4040 cli . writeText ( 'hello world' ) ;
41+ cli . writeText ( Buffer . from ( 'hello world (buffer)' ) ) ;
4142 cli . on ( 'message' , ( msg ) => {
4243
4344 if ( msg . mode !== $WS . EFrameReceiveMode . STANDARD ) {
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ export abstract class AbstractWsConnection extends $Events.EventEmitter implemen
162162 }
163163
164164 public writeText (
165- data : string | string [ ] ,
165+ data : Buffer | string | Array < Buffer | string > ,
166166 cb : D . IErrorCallback = this . _defaultWriteCallback ,
167167 ) : boolean {
168168
Original file line number Diff line number Diff line change @@ -474,9 +474,12 @@ export interface IWebSocket {
474474 /**
475475 * Send a text message to remote-side, in a single TEXT message.
476476 *
477- * > Return true if the data is flushed to kernel buffer completely, otherwise false.
477+ * @throws `E_CONN_LOST` will be thrown if the connection is closed.
478+ * @throws `E_CONN_READONLY` will be thrown if the connection is not writable (half-closed).
479+ *
480+ * @returns true if the data is flushed to kernel buffer completely, otherwise false.
478481 */
479- writeText ( data : string | string [ ] , callback ?: IErrorCallback ) : boolean ;
482+ writeText ( data : Buffer | string | Array < Buffer | string > , callback ?: IErrorCallback ) : boolean ;
480483
481484 /**
482485 * Send a binary message to remote-side, in a single BINARY message.
You can’t perform that action at this time.
0 commit comments