{"_id":"@afosecure/meshsdk","_rev":"2-095bfa7fbe713d46d06a7c7d85b8d21d","name":"@afosecure/meshsdk","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"@afosecure/meshsdk","version":"0.1.1","keywords":["afosecure","call","react","meeting","video","mesh","peer","webrtc","sdk","rust","sdk","typescript","videosdk"],"author":{"name":"Afolabi Mubarak"},"license":"MIT","_id":"@afosecure/meshsdk@0.1.1","maintainers":[{"name":"afowebdev","email":"afolabimubarak18@gmail.com"}],"homepage":"https://github.com/Megabyte-webdev/meshsdk","bugs":{"url":"https://github.com/Megabyte-webdev/meshsdk/issues"},"dist":{"shasum":"c4042b1990e2a1bef39cb1d876e9c06e7d665d11","tarball":"https://registry.npmjs.org/@afosecure/meshsdk/-/meshsdk-0.1.1.tgz","fileCount":3,"integrity":"sha512-ig0OXdZzOe3tBkyoepndiVpd/oa+ic6igqxJe0bL152DsuYGHqLKpwTWcxy8LcXpenO+pzE1GEOpMFe4tkwBVA==","signatures":[{"sig":"MEUCIEbWGuVmtbetwXHk9iHFyLwbbNQ8Iq5uY6IbG+YsVvqiAiEAq4KqyfHUlTmAx4mG8HyEKhxtBeWBtyxzlN0s3R1B0Yc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8097},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.mjs","require":"./dist/react.js"}},"gitHead":"8a436dc2e76203ae4f458a98adaba5119e34ee00","scripts":{"dev":"tsup src/index.ts --watch","build":"tsup src/index.ts --format esm,cjs --dts"},"_npmUser":{"name":"afowebdev","email":"afolabimubarak18@gmail.com"},"repository":{"url":"git+https://github.com/Megabyte-webdev/meshsdk.git","type":"git"},"_npmVersion":"10.9.2","description":"A modern, lightweight React SDK for building peer-to-peer video communication applications. Built on WebRTC with a clean, composable rust API.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"uuid":"^14.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","@types/ws":"^8.18.1","typescript":"^6.0.2","@types/react":"^19.2.14"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/meshsdk_0.1.1_1785089420494_0.08787848471371462","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@afosecure/meshsdk","version":"0.1.2","description":"A modern, lightweight React SDK for building peer-to-peer video communication applications. Built on WebRTC with a clean, composable rust API.","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","publishConfig":{"access":"public"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","import":"./dist/index.mjs"},"./react":{"types":"./dist/react.d.ts","require":"./dist/react.js","import":"./dist/react.mjs"}},"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts","dev":"tsup src/index.ts --watch"},"keywords":["afosecure","call","react","meeting","video","mesh","peer","webrtc","sdk","rust","sdk","typescript","videosdk"],"author":{"name":"Afolabi Mubarak"},"license":"MIT","homepage":"https://github.com/Megabyte-webdev/meshsdk","repository":{"type":"git","url":"git+https://github.com/Megabyte-webdev/meshsdk.git"},"bugs":{"url":"https://github.com/Megabyte-webdev/meshsdk/issues"},"peerDependencies":{"react":">=18","react-dom":">=18"},"dependencies":{"uuid":"^14.0.0"},"devDependencies":{"@types/react":"^19.2.14","@types/ws":"^8.18.1","tsup":"^8.5.1","typescript":"^6.0.2"},"_id":"@afosecure/meshsdk@0.1.2","gitHead":"eeac124f927412e46c481a4f540b42e3575af676","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-LKgI14pzaQwCZ/MIPecnqMPWp7MIb0HslE7wdnFsOZlzEhqFvzhXD0VPupj5HCP+f7MoAou1RyPiDUyQzVZF1A==","shasum":"6a09889a705e7c6f15eb8cda3009ab18177c0764","tarball":"https://registry.npmjs.org/@afosecure/meshsdk/-/meshsdk-0.1.2.tgz","fileCount":9,"unpackedSize":276503,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGO7MoXKsE0rfQIS0oz96pblin51p0L2OsTEOlfFIGjoAiByxje3EMXsTODm0vth7m5U6gwIAqbQqspolkCQeogUOA=="}]},"_npmUser":{"name":"afowebdev","email":"afolabimubarak18@gmail.com"},"directories":{},"maintainers":[{"name":"afowebdev","email":"afolabimubarak18@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/meshsdk_0.1.2_1785102483982_0.17765051025563094"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-26T18:10:20.381Z","modified":"2026-07-26T21:48:04.298Z","0.1.1":"2026-07-26T18:10:20.635Z","0.1.2":"2026-07-26T21:48:04.139Z"},"bugs":{"url":"https://github.com/Megabyte-webdev/meshsdk/issues"},"author":{"name":"Afolabi Mubarak"},"license":"MIT","homepage":"https://github.com/Megabyte-webdev/meshsdk","keywords":["afosecure","call","react","meeting","video","mesh","peer","webrtc","sdk","rust","sdk","typescript","videosdk"],"repository":{"type":"git","url":"git+https://github.com/Megabyte-webdev/meshsdk.git"},"description":"A modern, lightweight React SDK for building peer-to-peer video communication applications. Built on WebRTC with a clean, composable rust API.","maintainers":[{"name":"afowebdev","email":"afolabimubarak18@gmail.com"}],"readme":"# 📹 MESHSDK\n\nA lightweight React SDK for building peer-to-peer video conferencing applications using WebRTC Mesh networking. The SDK provides a modern React API, built-in meeting state management, screen sharing, chat, waiting room support, and flexible WebSocket signaling.\n\n---\n\n## Features\n\n- Peer-to-peer WebRTC Mesh architecture\n- HD audio and video\n- Screen sharing\n- Waiting room with host approval\n- Public and private in-meeting chat\n- Participant presence and media state\n- Automatic ICE restart & reconnection\n- STUN/TURN support\n- React Hooks API\n- Full TypeScript support\n- Lightweight with zero UI dependencies\n\n---\n\n## Installation\n\n```bash\nnpm install @afosecure/meshsdk\n```\n\nor\n\n```bash\npnpm add @afosecure/meetingsdk\n```\n\nor\n\n```bash\nyarn add @afosecure/meetingsdk\n```\n\n---\n\n# Quick Start\n\n## Create the SDK\n\n```tsx\nimport { useState } from \"react\";\nimport { MeetingProvider, VideoSDKCore } from \"@afosecure/meetingsdk\";\n\nexport default function App() {\n  const [sdk] = useState(\n    () =>\n      new VideoSDKCore({\n        onUserJoined: console.log,\n        onUserLeft: console.log,\n        onTrack: console.log,\n      }),\n  );\n\n  return (\n    <MeetingProvider core={sdk}>\n      <Meeting />\n    </MeetingProvider>\n  );\n}\n```\n\n---\n\n## Join a Meeting\n\n```tsx\nimport { useMeeting } from \"@afosecure/meetingsdk\";\n\nexport default function Meeting() {\n  const { joinMeeting, startLocalStream, leaveMeeting } = useMeeting();\n\n  const join = async () => {\n    await startLocalStream(videoRef.current!, \"John\");\n\n    await joinMeeting({\n      roomId: \"room-123\",\n      name: \"John\",\n    });\n  };\n\n  return (\n    <>\n      <button onClick={join}>Join</button>\n\n      <button onClick={leaveMeeting}>Leave</button>\n    </>\n  );\n}\n```\n\n---\n\n# React Hooks\n\n## useMeeting()\n\nProvides meeting actions and local participant state.\n\n```ts\nconst {\n  joinMeeting,\n  leaveMeeting,\n  toggleMic,\n  toggleCam,\n  startScreenShare,\n  stopScreenShare,\n  sendChatMessage,\n  participants,\n  localParticipant,\n  presenterId,\n} = useMeeting();\n```\n\n---\n\n## useParticipants()\n\nReturns all remote participants.\n\n```ts\nconst participants = useParticipants();\n```\n\n---\n\n## useLocalParticipant()\n\n```ts\nconst participant = useLocalParticipant();\n```\n\n---\n\n## useChat()\n\n```ts\nconst { messages, sendChatMessage } = useChat();\n```\n\n---\n\n## useMeetingState()\n\nSubscribe to the underlying reactive meeting state.\n\n```ts\nconst meeting = useMeetingState();\n```\n\n---\n\n# Meeting Events\n\n```ts\nconst sdk = new VideoSDKCore({\n  onTrack(stream, participantId) {},\n\n  onUserJoined(participant) {},\n\n  onUserLeft(participantId) {},\n\n  onChatMessage(message) {},\n\n  onScreenShareStarted(id, stream) {},\n\n  onScreenShareStopped(id) {},\n\n  onMicToggled(id, enabled) {},\n\n  onCamToggled(id, enabled) {},\n\n  onMeetingLeft() {},\n\n  onError(error) {},\n});\n```\n\n---\n\n# Features\n\n## Audio & Video\n\n- Camera\n- Microphone\n- Mute / Unmute\n- Camera On / Off\n\n---\n\n## Screen Sharing\n\n```ts\nawait startScreenShare();\n\nstopScreenShare();\n```\n\nSupports:\n\n- Presenter detection\n- Automatic renegotiation\n- Browser stop-share handling\n\n---\n\n## Waiting Room\n\nSupports:\n\n- Join requests\n- Host approval\n- Host rejection\n- Rejoin after approval\n\nEvents:\n\n```ts\nonEntryRequested();\n\nonEntryResponded();\n```\n\n---\n\n## Chat\n\nSupports:\n\n- Public messages\n- Private messages\n- Replies\n- Optimistic updates\n\n```ts\nsendChatMessage({\n  message: \"Hello everyone!\",\n});\n```\n\n---\n\n# Architecture\n\n```\nParticipant A\n       │\n       │\n   WebSocket\n(Signaling Only)\n       │\nParticipant B\n\nMedia\n──────────────►\nDirect WebRTC\nPeer Connection\n```\n\nMedia never passes through the signaling server.\n\nThe WebSocket server is only responsible for:\n\n- room management\n- participant discovery\n- signaling\n- waiting room\n- ICE exchange\n\n---\n\n# Server Requirements\n\nYour signaling server should support the following messages.\n\n## Client → Server\n\n- JOIN\n- LEAVE\n- OFFER\n- ANSWER\n- ICE\n- CHAT_MESSAGE\n- MEDIA_STATE\n- SCREEN_SHARE_START\n- SCREEN_SHARE_STOP\n- JOIN_APPROVE\n- JOIN_REJECT\n- PING\n\n---\n\n## Server → Client\n\n- JOINED\n- EXISTING_USERS\n- USER_JOINED\n- USER_LEFT\n- OFFER\n- ANSWER\n- ICE\n- CHAT_MESSAGE\n- MEDIA_STATE_CHANGE\n- SCREEN_SHARE_START\n- SCREEN_SHARE_STOP\n- JOIN_PENDING\n- JOIN_APPROVED\n- JOIN_REJECTED\n- ERROR\n- PONG\n\n---\n\n# STUN & TURN\n\nThe SDK expects the signaling server to provide ICE servers during the JOIN flow.\n\nExample:\n\n```json\n{\n  \"iceServers\": [\n    {\n      \"urls\": [\"stun:stun.l.google.com:19302\"]\n    },\n    {\n      \"urls\": [\"turn:turn.example.com:3478\"],\n      \"username\": \"...\",\n      \"credential\": \"...\"\n    }\n  ]\n}\n```\n\n---\n\n# Browser Support\n\n- Chrome\n- Edge\n- Firefox\n- Safari\n\n---\n\n# Mesh Networking\n\nThis SDK uses a Mesh topology.\n\nEvery participant establishes a direct WebRTC connection with every other participant.\n\nBest suited for:\n\n- One-to-one calls\n- Interviews\n- Online consultations\n- Small meetings\n- Team discussions\n\nFor larger meetings (10+ participants), an SFU architecture is recommended.\n\n---\n\n# License\n\nMIT\n","readmeFilename":"README.md"}