Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodejs-websocket

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-websocket - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

15

Connection.js

@@ -168,2 +168,17 @@ /**

/**
* Sends a text or binary frame
* @param {string|Buffer} data
* @param {Function} [callback] will be executed when the data is finally written out
*/
Connection.prototype.send = function (data, callback) {
if (typeof data === 'string') {
this.sendText(data, callback)
} else if (Buffer.isBuffer(data)) {
this.sendBinary(data, callback)
} else {
throw new TypeError('data should be either a string or a Buffer instance')
}
}
/**
* Sends a ping to the remote

@@ -170,0 +185,0 @@ * @param {string} [data=''] - optional ping data

3

HISTORY.md

@@ -0,1 +1,4 @@

# 1.5.0
* Added: `Connection#send` as a short hand for `Connection#sendText` or `Connection#sendBinary`, depending on the data type (string or Buffer)
# 1.4.1

@@ -2,0 +5,0 @@ * Added: example to README

4

package.json
{
"name": "nodejs-websocket",
"version": "1.4.1",
"version": "1.5.0",
"author": "Sitegui <sitegui@sitegui.com.br>",

@@ -25,4 +25,4 @@ "description": "Basic server&client approach to websocket (text and binary frames)",

"mocha": "^2.3.4",
"should": "^7.1.1"
"should": "^8.1.0"
}
}

@@ -118,2 +118,7 @@ # Nodejs Websocket

## connection.send(data, [callback])
Sends a given string or Buffer to the other side. This is simply an alias for `sendText()` if data is a string or `sendBinary()` if the data is a Buffer.
`callback` will be added as a listener to write operation over the socket
## connection.sendPing([data=''])

@@ -120,0 +125,0 @@ Sends a [ping](http://tools.ietf.org/html/rfc6455#section-5.5.2) with optional payload

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc