New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mq-p2p-client

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mq-p2p-client

MQ-P2P-Client

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Chạy dạng service mode:

./mq-p2p-client update-config agentId hoặc ./mq-p2p-client generate-id ./mq-p2p-client update-config SERVER https://p2p.demo.mqsolutions.vn ./mq-p2p-client add-protocol <local_port> Ví dụ: ./mq-p2p-client add-protocol camera01 127.0.0.1:22 8082

./mq-p2p-client startup

Chạy dạng sdk mode:

import PeerConnection from 'mq-p2p-client';

(async () => { const client = new PeerConnection({ peerId: "<device_id>", server: "<server_address>" });

await client.createConnection();
client.dialWithPort({
    port: <local_port>, //8082
    protocol: "<protocol>" //157.245.159.219:22
})
client.dialWithPort({
    port: 8283,
    protocol: "192.168.6.84:22"
})

})();

chạy dạng javascript module:

    const PeerConnection = require('PeerConnection'); //import PeerConnection from 'mq-p2p-client'
    const peer = new PeerConnection({
        agentId: "local-peer-id",
        peerId: "remote-peer-id",
        server: "https://p2p.demo.mqsolutions.vn"
    });

    const result = await peer.createConnection();
    const stream = peer.dial("127.0.0.1:8082");

Lấy stream ở client:

const videoElement = document.getElementById("video");
const PeerMediaStream = require('PeerMediaStream'); //import {PeerMediaStream} from 'mq-p2p-client'
await PeerMediaStream.connect({
        peer: peer, //peerConnection được khởi tạo ở bước trên.
        streamServer: "127.0.0.1:6002" //địa chỉ stream server theo remote IP. Mặc định là 127.0.0.1:6002, Optional.
        videoElement: videoElement, //video element
        cameraId: cameraId //ID của camera tại server stream.
});

Keywords

FAQs

Package last updated on 06 Jan 2022

Did you know?

Socket

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.

Install

Related posts

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