> For the complete documentation index, see [llms.txt](https://biot-ws.gitbook.io/biot-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://biot-ws.gitbook.io/biot-core/api/events.md).

# Events

## text

{% tabs %}
{% tab title="JS module" %}

```javascript
const eventBus = require('byteballcore/event_bus');

eventBus.on('text', (from_address, text) => {
    console.log('from:', from_address, ' || text:', text);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'subscribe',
    args: ['text']
}));

socket.onmessage = function (event) {
    let data = JSON.parse(event.data);
    if (data.id === -2 && data.name === 'text') {
        let result = data.result;
			console.log('from:', result.from_address, ' || text:', result.text);
			return;
    }
}
```

{% endtab %}
{% endtabs %}

## paired

{% tabs %}
{% tab title="JS module" %}

```javascript
const eventBus = require('byteballcore/event_bus');

eventBus.on('paired', (from_address, pairing_secret) => {
    console.log('address:', from_address, ' || pairing_secret:', text);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'subscribe',
    args: ['paired']
}));

socket.onmessage = function (event) {
    let data = JSON.parse(event.data);
    if (data.id === -2 && data.name === 'paired') {
        let result = data.result;
			console.log('address:', result.from_address, ' || pairing_secret:', result.text);
			return;
    }
}
```

{% endtab %}
{% endtabs %}

## new\_my\_transactions

{% tabs %}
{% tab title="JS module" %}

```javascript
const eventBus = require('byteballcore/event_bus');

eventBus.on('new_my_transactions', (arrUnits) => {
    console.log('new_my_transactions:', arrUnits);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'subscribe',
    args: ['new_my_transactions']
}));

socket.onmessage = function (event) {
    let data = JSON.parse(event.data);
    if (data.id === -2 && data.name === 'new_my_transactions') {
        let result = data.result;
			console.log('new_my_transactions:', result.arrUnits);
			return;
    }
}
```

{% endtab %}
{% endtabs %}

## new\_joint

{% tabs %}
{% tab title="JS module" %}

```javascript
const eventBus = require('byteballcore/event_bus');

eventBus.on('new_joint', (objJoint) => {
    console.log('new_joint:', objJoint);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'subscribe',
    args: ['new_joint']
}));

socket.onmessage = function (event) {
    let data = JSON.parse(event.data);
    if (data.id === -2 && data.name === 'new_joint') {
        let result = data.result;
			console.log('new_joint:', result.objJoint);
			return;
    }
}
```

{% endtab %}
{% endtabs %}

## my\_transactions\_became\_stable

{% tabs %}
{% tab title="JS module" %}

```javascript
const eventBus = require('byteballcore/event_bus');

eventBus.on('my_transactions_became_stable', (arrUnits) => {
    console.log('my_transactions_became_stable:', arrUnits);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
    id: i++,
    name: 'subscribe',
    args: ['my_transactions_became_stable']
}));

socket.onmessage = function (event) {
    let data = JSON.parse(event.data);
    if (data.id === -2 && data.name === 'my_transactions_became_stable') {
        let result = data.result;
			console.log('my_transactions_became_stable:', result.arrUnits);
			return;
    }
}
```

{% endtab %}
{% endtabs %}
