
Product
Introducing .NET Support in Socket
Socket now supports .NET, bringing supply chain security and SBOM accuracy to NuGet and MSBuild-powered C# projects.
browser-mirror
Advanced tools
Lets a user open a webpage on one browser and control that webpage in other browsers, on other computers as a light-weight alternative to screensharing.
Browser-Mirror allows two (or more) remote browsers visiting the same web page to share state without the overhead of screen sharing.
mkdir bm-server && cd bm-server
sudo -s # Login as root if needed
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/Pamblam/browser-mirror/master/installer)"
bm server start
to start the websocket server. You can give it a port number if you want it to run on a port other than 1337 (eg, bm server start 1223
)bm server stop
to stop the serverbm server logs
to view the server logsbm server stop
bm update
bm --version
bm server start
Run man bm
or bm --help
for further uses & info.
Add the client side JS file to your project, either by running bm client install /path/to/project
or download it manually from the git repo, then put in a script tag.
-> Important: This script must be included above all other Javascripts <-
<script src='bm-client.js'></script>
The master page will control all the "slave" pages.
const mirror = BMClient(1, '127.0.0.1', 'master');
The parameters are..
mirror.onError(err=>{
// do something with the err
alert(err.message);
});
By default, if the app needs to confirm an action with a user it will use the native confirm
method. If you want to use your own method you can define it with the onSessionConfirm
method.
Your confirmation method will receive a single object with 2 properties. Its message
property is the message to be shown to the user. The confim_action
is to be passed thru to the return object's action
method, which tells the server which confirmation you're responding to.
Your confirmation method must return an object containing two properties:
confirm
: The boolean value of the user's response.action
: Passed to the function as the confim_action
string.Alternatively, your method may return a Promise
which resolves with the above described object.
mirror.onSessionConfirm(data=>new Promise(data=>{
do_confirm(data.message).then(result=>{
done({
confirm: result,
action: data.confirm_action
});
});
}));
This is mainly called when someone leaves or joins the session.
mirror.onSessionUpdate(data=>{
document.getElementById("count").innerHTML = `${data.members} people in the current session`;
});
The connect method takes one optional parameter, a number 0, 1, or 2:
0
(default) - Do not enforce browser restrictions. This is fine if you use a CSS reset.
1
- Force all members to use the same browser as the leader for the best experience.
2
- Warn members that are not using the same browser as the leader that they will have a better experience if they use whatever browser the leader is using, but allow them to continue using the browser they're using.
mirror.connect(2);
Only the master should call the start
method, and it should only be called when the session has all it's members. Monitor the data.members
on each session update and call start
when everyone has joined. Once the start
method is called, no others will be allowed to join.
You can optionally pass true
into the start method to resize all browsers to match the size of the smallest browser in the session. This is helpful if the page being viewed is responsive or uses percentages for positioning by making sure the mouse cursor is always over the same elements for each of the members.
mirror.start()
You can also broadcast custom data fro the master to each client.
In the master....
mirror.setState({ anything: anything });
in the client....
mirror.onStateChange(state=>console.log(state.anything));
If your site runs over HTTPS you must secure your websocket connection or none of this will work.
Before starting the server you just have to configure it to use your SSL certificate, key and ca file. If you do not know where these are located read this for some help figuring it out.
From the server machine just run these three commands to provide the server with your certificate info and it will automatically run over a secure connection from then on. Substitute the paths for the paths to your own files.
bm set certificate /path/to/my/certificate
bm set key /path/to/my/key
bm set ca /path/to/my/ca
To secure the client you just instantiate the class with the secure
method like so:
const mirror = BMClient(1, '127.0.0.1', 'master').secure();
Everything else works as described above.
FAQs
Lets a user open a webpage on one browser and control that webpage in other browsers, on other computers as a light-weight alternative to screensharing.
The npm package browser-mirror receives a total of 32 weekly downloads. As such, browser-mirror popularity was classified as not popular.
We found that browser-mirror demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Socket now supports .NET, bringing supply chain security and SBOM accuracy to NuGet and MSBuild-powered C# projects.
Research
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.