
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@yomo/react-cursor-chat
Advanced tools
A react component helps bring Figma's Cursor Chat to your web applications in less than 3 minutes, making real-time collaboration anywhere based on Presencejs.
/
to bring up the input boxby npm
:
$ npm i --save @yomo/react-cursor-chat @yomo/presence
by pnpm
:
$ pnpm add @yomo/react-cursor-chat @yomo/presence
create .env
with:
NEXT_PUBLIC_PRESENCE_URL=https://lo.yomo.dev:8443/v1
NEXT_PUBLIC_PRESENCE_PUBLIC_KEY=YOUR_PK
If you use nextjs, you can use this example:
"use client";
import { createPresence, IPresence } from "@yomo/presence";
import CursorChat from "@yomo/react-cursor-chat";
import "@yomo/react-cursor-chat/dist/style.css";
import { useEffect, useState } from "react";
const App = () => {
const user = {
id: Math.random().toString(36).substring(7), // random id (e.g. 5b3f1e)
name: "Peter Parker",
avatar: "https://i.pravatar.cc/150?img=3",
};
const [presence, setPresence] = useState<Promise<IPresence> | null>(null);
useEffect(() => {
(async () => {
let url =
process.env.NEXT_PUBLIC_PRESENCE_URL || "https://lo.yomo.dev:8443/v1";
const presence = createPresence(url, {
publicKey: process.env.NEXT_PUBLIC_PRESENCE_PUBLIC_KEY,
id: user.id,
autoDowngrade: true, // downgrade to websocket automatically if webTransport not work
});
setPresence(presence);
})();
}, []);
if (!presence) return <div>Loading...</div>;
return (
<div>
<CursorChat
presence={presence}
id={user.id}
name={user.name}
avatar={user.avatar}
/>
</div>
);
};
export default App;
Be sure to disable React's reactStrictMode to avoid potential issues. In React, you can disable it by removing the <React.StrictMode> component from the root file.
In Next.js, you can disable the strict mode by modifying the next.config.js
file. To do so, add the following configuration:
const nextConfig = {
reactStrictMode: false,
};
Before running the frontend project, you need start the Presence Server: prscd service.
The prscd
can be download from the release page.
Or, you can gh repo clone yomorun/presencejs
to get the source code, and run cd prscd && make dev
to start in development mode.
For the convenience of developers, we provide a free hosting service for Presence Server for concurrent connections less than 1000, request for your own on Allegro Cloud.
FAQs
Cursor Chat like Figma
We found that @yomo/react-cursor-chat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.