
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@yomo/presencejs
Advanced tools
You can use @yomo/presencejs to integrate YoMo's real-time platform into your web applications.
Using npm
$ npm i --save @yomo/presencejs
For CDN, you can use skypack: https://cdn.skypack.dev/@yomo/presencejs
<script type="module">
import { YoMoClient } from 'https://cdn.skypack.dev/@yomo/presencejs';
</script>
The client need to authenticate with YoMo to establish a realtime connection. The following code sample uses a demo YoMo's server(wss://ws-dev.yomo.run
) and public Key to authenticate and print the message Connected to YoMo!
when you’ve successfully connected.
import { YoMoClient } from '@yomo/presencejs';
// create an instance.
const yomoclient = new YoMoClient('wss://ws-dev.yomo.run', {
// Authentication
auth: {
// Certification Type.
// Optional values:'publickey' or 'token'.
// 'token' is not yet supported.
type: 'publickey',
// The public key in your Allegro Mesh project.
publicKey: '',
},
// The reconnection interval value.
// The default value is 5000.
reconnectInterval: 5000,
// The reconnection attempts value.
// The default value is 3.
reconnectAttempts: 3,
});
yomoclient.on('connected', () => {
console.log('Connected to YoMo');
});
yomoclient.on('connected', () => {
// Get a room.
const room = yomoclient.getRoom('001');
// Handle events from the server and subscribe to data frames
room.fromServer('online').subscribe(data => {
console.log('online:', data);
});
room.fromServer('mousemove').subscribe(data => {
console.log('mousemove:', data);
});
});
import { map, throttleTime } from 'rxjs/operators';
yomoclient.on('connected', () => {
const room = yomoclient.getRoom('001');
// Push data frames immediately.
room.publish('online', {
id: 'ID',
x: 10,
y: 10,
});
// Converting browser events into observable sequences.
const mousemove$ = room
.fromEvent(document, 'mousemove')
// You can use RxJS Operators.
.pipe(
throttleTime(200),
map(event => {
return {
id: 'ID',
x: event.clientX,
y: event.clientY,
};
})
);
// Bind the event source to YoMo's service,
// which will automatically push the data frame.
room.bindServer(mousemove$, 'mousemove');
});
A connection to YoMo can be closed once it is no longer needed.
yomoclient.close();
yomoclient.on('closed', () => {
console.log('Closed the connection to YoMo.');
});
Methods of instance | Description | Type |
---|---|---|
on | Subscribe to the connection and disconnection status | on(event: 'connected' | 'closed', cb: () => void): void |
close | A connection to YoMo can be closed once it is no longer needed. | close(): void |
getRoom | Get a room. | getRoom(id: string): Room |
Methods of instance | Description | Type |
---|---|---|
fromServer | Handle event from the server. | fromServer<T>(event: string): Observable<T> |
bindServer | Bind the event source to YoMo's service, which will automatically push the data frame. | bindServer<T>(source: Observable<T>, event: string): Subscription |
fromEvent | Converting browser events into observable sequences. Same as RxJS. | fromEvent<T>(target: FromEventTarget<T>, event: string): Observable<T> |
publish | Push data frames immediately. | publish<T>(event: string, data: T) |
FAQs
@yomo/presencejs ⚡️ made realtime web applications edge-aware by YoMo
The npm package @yomo/presencejs receives a total of 5 weekly downloads. As such, @yomo/presencejs popularity was classified as not popular.
We found that @yomo/presencejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.