{"_id":"@arthurdevfrontend/miniwebsocket","_rev":"7-e3e1d1e330121560b6fe25dd39d28219","name":"@arthurdevfrontend/miniwebsocket","dist-tags":{"latest":"1.2.1"},"versions":{"1.0.0":{"name":"@arthurdevfrontend/miniwebsocket","version":"1.0.0","keywords":["websocket","mini","realtime","node.js"],"author":{"name":"ArthurDev"},"license":"MIT","_id":"@arthurdevfrontend/miniwebsocket@1.0.0","maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"dist":{"shasum":"1740ae62c1b2efd7553ad7ab2d06d79ca45d4d97","tarball":"https://registry.npmjs.org/@arthurdevfrontend/miniwebsocket/-/miniwebsocket-1.0.0.tgz","fileCount":3,"integrity":"sha512-4n0iADS9Oj1lFV/+CCOpyxS6OvLkkIp16G47tBilI6tl18QT2hkq1e9EU9km78TubzJGGVr2aJuuGA0+I7oFhw==","signatures":[{"sig":"MEQCIDoEHjZgclQjAy8cjrvuE6nH45P3ip9XecuRPBhSFyvmAiBW+YJGvvuCCzUE6D9YMMHeSPcUsIKT16sX+gl7PB5EaA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":693},"main":"js/miniwebsocket.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"},"repository":{"url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git","type":"git"},"_npmVersion":"10.9.3","description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/miniwebsocket_1.0.0_1758727318038_0.9783435064840782","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arthurdevfrontend/miniwebsocket","version":"1.0.1","keywords":["websocket","mini","realtime","node.js"],"author":{"name":"ArthurDev"},"license":"MIT","_id":"@arthurdevfrontend/miniwebsocket@1.0.1","maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"dist":{"shasum":"6684de5ac5ec6dbb08aa7dc1dfa50dc8a30b6f07","tarball":"https://registry.npmjs.org/@arthurdevfrontend/miniwebsocket/-/miniwebsocket-1.0.1.tgz","fileCount":3,"integrity":"sha512-E4Of/80DjiV9SX/1AaKmUKxhjY6bXPXIGxe8G7jMlHpFbwGCE1bZm3Ei4wQ2Msrwjwkv3Nrx1V3nqEhUsKe7AA==","signatures":[{"sig":"MEUCIBDVre3ip4Z8n7QytU6is8X+bbZe/fGsYUR364CTbzQ4AiEA1pNuurpNJiuz4lVVK/CwKtCHF/LRuvHZfdyn9MOjk6w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1893},"main":"js/miniwebsocket.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"},"repository":{"url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git","type":"git"},"_npmVersion":"10.9.3","description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/miniwebsocket_1.0.1_1758732132506_0.9468396187095749","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@arthurdevfrontend/miniwebsocket","version":"1.0.2","keywords":["websocket","mini","realtime","node.js"],"author":{"name":"ArthurDev"},"license":"MIT","_id":"@arthurdevfrontend/miniwebsocket@1.0.2","maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"dist":{"shasum":"1968a05f553753891bcf5c152dd9563af3ed5b91","tarball":"https://registry.npmjs.org/@arthurdevfrontend/miniwebsocket/-/miniwebsocket-1.0.2.tgz","fileCount":3,"integrity":"sha512-q0BYV1OpDvILtFbOzXhzcPf6p+ssu6FYg+1bmTfBiGN7zEKQbH4dj8Pgrtq+MCtDA/pgxxv/Pe/ZQ3LlMRvNjg==","signatures":[{"sig":"MEYCIQDpxSI16mY0VGjY51aNx/pztHHUxFdrvjYkZ71TtBK+IwIhAO6DHER9icowqn9hcaUhwm35NNPuW1Te8jUVFJHlpodg","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5638},"main":"js/miniwebsocket.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"},"repository":{"url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git","type":"git"},"_npmVersion":"10.9.3","description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/miniwebsocket_1.0.2_1758739138354_0.9709861318211481","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@arthurdevfrontend/miniwebsocket","version":"1.0.3","keywords":["websocket","mini","realtime","node.js"],"author":{"name":"ArthurDev"},"license":"MIT","_id":"@arthurdevfrontend/miniwebsocket@1.0.3","maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"dist":{"shasum":"59bfd27e8f017757b4779cc3b31d3822b6db73aa","tarball":"https://registry.npmjs.org/@arthurdevfrontend/miniwebsocket/-/miniwebsocket-1.0.3.tgz","fileCount":3,"integrity":"sha512-h+wEMoloIa+SWM7/bhqDaKaF3jwE05MMA3F7C0YdKr3XPFfBiQpE5GBsPvP6vd2UWEReobsXVtZcMNv5FjI5bQ==","signatures":[{"sig":"MEUCIQCHIkDeYxjviuZCTYyoeDydlKqmwVHAUaL6y6mAvgG44AIgLEUUAV9YINgGgzdXQbjcJ5KnBIOiPnmTmGFhekxBXz0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7471},"main":"js/miniwebsocket.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"},"repository":{"url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git","type":"git"},"_npmVersion":"10.9.3","description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/miniwebsocket_1.0.3_1758747590404_0.43697197576917524","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@arthurdevfrontend/miniwebsocket","version":"1.1.0","keywords":["websocket","mini","realtime","node.js"],"author":{"name":"ArthurDev"},"license":"MIT","_id":"@arthurdevfrontend/miniwebsocket@1.1.0","maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"dist":{"shasum":"2c510b67db6349aaf090f36405eff6e8b3fa86f1","tarball":"https://registry.npmjs.org/@arthurdevfrontend/miniwebsocket/-/miniwebsocket-1.1.0.tgz","fileCount":3,"integrity":"sha512-u833UQHgtUtunvhkMUkvTW/hBm6WCvH9wGNy65ZdbzPaR1irb8sbvQTLoL4xW3fJLJpyhpSZ86MOUuwhNYRayw==","signatures":[{"sig":"MEYCIQCzhV0t6X8VpyGoxnFN2JfME0YTjRqpoKIpiixU04TcuwIhAOmZZ9y2H1xTX6PNopzweK3R/pcNs9fvsaK34BK8fZtD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7471},"main":"js/miniwebsocket.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"},"repository":{"url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git","type":"git"},"_npmVersion":"10.9.3","description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/miniwebsocket_1.1.0_1758827878068_0.8659181558255582","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@arthurdevfrontend/miniwebsocket","version":"1.2.0","keywords":["websocket","mini","realtime","node.js"],"author":{"name":"ArthurDev"},"license":"MIT","_id":"@arthurdevfrontend/miniwebsocket@1.2.0","maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"dist":{"shasum":"54847738d15c8c84a0817231b525f57a4b7828d7","tarball":"https://registry.npmjs.org/@arthurdevfrontend/miniwebsocket/-/miniwebsocket-1.2.0.tgz","fileCount":3,"integrity":"sha512-A64YtDREi6PSPVs0guSGzaXRztqZ/jjF/QJ8EaOBl+OWYrlwSacPS5ySXh8igfXQbWPe0awlYQ0hrZ6MP36dbA==","signatures":[{"sig":"MEUCIEZwHVE8jdF3PhfjVLd22TkA75d+sjxdgfN+BU5SOPEyAiEA+0fDK/F0SJp9uQN8577j2Cq0iUTflseLPIFSg8f373w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7017},"main":"js/miniwebsocket.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"},"repository":{"url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git","type":"git"},"_npmVersion":"10.9.3","description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/miniwebsocket_1.2.0_1759158662382_0.16569537521952427","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@arthurdevfrontend/miniwebsocket","version":"1.2.1","description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","main":"js/miniwebsocket.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git"},"keywords":["websocket","mini","realtime","node.js"],"author":{"name":"ArthurDev"},"license":"MIT","bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","_id":"@arthurdevfrontend/miniwebsocket@1.2.1","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-XQ6zkES+2LUtBwVjSAQcQj7Ke5pFG7SGCBsm+fqD6x7SonkhkovRN0m+v557H8kXzzgbKqTUhRZDUct16bzoog==","shasum":"ec3e4d0afe5bff9ba95709963edfbed406fc4c99","tarball":"https://registry.npmjs.org/@arthurdevfrontend/miniwebsocket/-/miniwebsocket-1.2.1.tgz","fileCount":3,"unpackedSize":7330,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDWRchtk6Te+s/uJJbeasdLfytnat/492ovEDBERGgbgAIhAOp7suA6plvJFdrClotAxTFR+LgXPxzndggfhMA3eqbn"}]},"_npmUser":{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"},"directories":{},"maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/miniwebsocket_1.2.1_1759158732811_0.6141800467968328"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-24T15:21:57.947Z","modified":"2025-09-29T15:12:13.221Z","1.0.0":"2025-09-24T15:21:58.224Z","1.0.1":"2025-09-24T16:42:12.719Z","1.0.2":"2025-09-24T18:38:58.532Z","1.0.3":"2025-09-24T20:59:50.609Z","1.1.0":"2025-09-25T19:17:58.255Z","1.2.0":"2025-09-29T15:11:02.546Z","1.2.1":"2025-09-29T15:12:13.038Z"},"bugs":{"url":"https://github.com/arthurdevfrontend-tech/MiniWebSocket/issues"},"author":{"name":"ArthurDev"},"license":"MIT","homepage":"https://github.com/arthurdevfrontend-tech/MiniWebSocket#readme","keywords":["websocket","mini","realtime","node.js"],"repository":{"type":"git","url":"git+https://github.com/arthurdevfrontend-tech/MiniWebSocket.git"},"description":"Blibioteca MiniWebSocket minimalista para comunicação em tempo real","maintainers":[{"name":"arthurdevfrontend","email":"arthurmiguel7988@gmail.com"}],"readme":"# MiniWebSocket\r\n\r\nMiniWebSocket é uma biblioteca JavaScript minimalista para criar **conexões WebSocket** em tempo real, tanto no servidor quanto no cliente.  \r\nCom ela, você consegue criar chats, notificações e sistemas que precisam de comunicação instantânea de forma fácil e rápida.\r\n\r\n---\r\n\r\n## 💡 Funcionalidades\r\n\r\n- Conexão simples via `new MiniWebSocket(url)`\r\n- Reconexão automática com tentativas configuráveis\r\n- Fila de mensagens offline (não perde msgs se mandar antes de conectar)\r\n- Broadcast para todos os clientes\r\n- Salas (rooms) com usuários\r\n- Histórico de mensagens com limite configurável\r\n- Sistema de eventos estilo Node (`on(\"message\")`, `on(\"open\")`, etc.)\r\n- Ping/Pong automático para verificar se cliente está online\r\n- Leve, sem dependências externas\r\n- Logs opcionais com `debug: true`\r\n\r\n---\r\n\r\n## ⚡ Instalação\r\n\r\nSe você estiver usando **Node.js**, basta instalar via npm:\r\n\r\n```bash\r\nnpm i @arthurdevfrontend/miniwebsocket\r\n\r\n```\r\n\r\nou, se usar _Yarn_\r\n\r\n```bash\r\nyarn add @arthurdevfrontend/miniwebsocket\r\n```\r\n\r\nProntinho! Agora a blibioteca está instalada 🎉\r\n\r\n# Uso Básico🧩\r\n\r\n1️⃣ Criar o servidor\r\n\r\nCrie um arquivo chamado `server.js` e escreva assim:\r\n\r\n```javascript\r\n\r\nconst { WebSocketServer } = require(\"arthurdevfrontend/miniwebsocket)\r\n\r\n// Criar o servidor na porta 8080\r\nconst server = new WebSocketServer({ port: 8080});\r\n\r\n// Quando alguém se conectar\r\nserver.on(\"connection\", (socket) => {\r\n    console.log(\"Alguém se conectou!\")\r\n\r\n    // Receber mensagem de um cliente\r\n    socket.on(\"message\", (msg) => {\r\n        console.log(\"Mensagem Recebida\")\r\n\r\n\r\n        // Mandar a mensagem para todo mundo\r\n        server.broadcast(`Alguem disse: ${msg}`);\r\n\r\n    });\r\n\r\n\r\n\r\n    socket.send(\"Bem vindo ao MiniWebSocket\")\r\n});\r\n```\r\n\r\n# 2️⃣ Criar o Cliente (Node.js)\r\n\r\nCrie um arquivo chamado `Client.js`\r\n\r\n```javascript\r\nconst { WebSocket } = require(\"@arthurdevfrontend/miniwebsocket\")\r\n\r\n// Conectar ao servidor\r\nconst socket = new WebSocket(\"ws://localhost:8080\",{\r\n  reconnectInterval: 3000,\r\n  maxReconnectAttempts: 10\r\n  debug: true,\r\n});\r\n\r\n// Quando receber mensagem\r\nsocket.on(\"message\", (msg) => {\r\n  console.log(\"Servidor diz:\", msg);\r\n});\r\n\r\n// Mandar mensagem para o servidor\r\nsocket.send(\"Oi, servidor!\");\r\n```\r\n\r\n# 3️⃣ Rodar\r\n\r\nNo terminal primeiro rode o servidor:\r\n\r\n```bash\r\nnode server.js\r\n\r\n```\r\n\r\nDepois em outro terminal rode o cliente\r\n\r\n```bash\r\nnode client.js\r\n```\r\n\r\n# 4️Testando recursos extras do MiniWebSocket\r\n\r\n- _Broadcast:_ envia para todos os clientes:\r\n\r\n```javascript\r\nserver.broadcast(\"Mensagem global pra todos!\");\r\n```\r\n\r\n- Salas(Rooms):\r\n\r\n```javascript\r\nsocket.joinRoom(\"sala1\");\r\nsocket.sendToRoom(\"sala1\", \"Mensagem só pra essa sala\");\r\n```\r\n\r\n- _Ping:_ testar se o cliente está online\r\n\r\n```javascript\r\nsocket.ping();\r\n```\r\n\r\n- Reconexão automática: se o cliente perder a conexão ele tentar reconectar sozinho,\r\n  conforme você definiu no `reconnectInterval` e `maxReconnectAttempts`.\r\n  Você vera mensagem rodando em tempo real!🥳\r\n\r\n🎯Dicas fáceis para começar\r\n\r\n- Pense Que Cada Cliente e um amiguinho para conversar\r\n- `send()` manda mensagem\r\n- `on(\"message\", ...)` escuta quando alguém manda mensagem\r\n- `broadcast()`manda mensagem para todos tudo de uma vez.\r\n  Com isso voce consuege criar um chat divertido ou avisos em tempo real🐱‍👤\r\n\r\n💡 Dica final: Pense nos WebSockets como um telefone mágico, onde todo mundo pode falar e ouvir ao mesmo tempo, sem presisar desligar e ligar o telefone. 📞\r\n","readmeFilename":"README.md"}