Skip to content

Commit

Permalink
split data with a limit of number of desired chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
jensstigaard committed Mar 25, 2024
1 parent f49bc0f commit b5fdd55
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/modules/connection-tcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export class ConnectionTCP {
// ///////////////////////////////

/**
* Set host
* Set host of vMix instance
*
* @param {string} host
*/
Expand All @@ -311,7 +311,7 @@ export class ConnectionTCP {
}

/**
* Set port
* Set port of vMix instance
*
* @param {number} port
*/
Expand All @@ -337,7 +337,7 @@ export class ConnectionTCP {
const data = this._buffer.toString()

// Split on each new line
const receivedLines = data.split('\r\n')
const receivedLines = data.split('\r\n', 2)

// If less than two lines were found
// do not process buffer yet - keep whole buffer
Expand Down Expand Up @@ -413,8 +413,6 @@ export class ConnectionTCP {
this._debugBuffer && console.log('[node-vmix]', 'Emitting error message:', firstMessage)
this._emitMessage(firstMessage)
} else {


const messageTypeLower = messageType.toLowerCase()

this._debugBuffer && console.log('[node-vmix]', 'Handling custom message:', messageType)
Expand Down Expand Up @@ -703,7 +701,7 @@ export class ConnectionTCP {
* @returns {Promise}
*/
protected _sendMessageToSocket = async (message: string) => {
this._debug && console.log('[node-vmix]', 'Sending message to vMix instance via socket', message)
this._debug && console.log('[node-vmix]', 'Sending message to vMix instance via socket:', message)

// Guard connected
// if (!this.connected()) {
Expand Down Expand Up @@ -897,6 +895,8 @@ export class ConnectionTCP {
// @ts-ignore - Why is readyState not in ts doctype???
// return this._socket.readyState === 'open'

// console.log('ReadyState=', this._socket.readyState)

return this._isConnected
}

Expand Down

0 comments on commit b5fdd55

Please sign in to comment.