Closed itsabubaker closed 1 week ago
If I'm reading the stack correctly, you are using this library as part of a NodeJS application. This library only supports Web and not NodeJS. You can add NodeJS by adding your NodeJS WebSocket adapter. Feel free to open a PR with these changes.
Also, for the future, development questions should be asked on https://forum.heroiclabs.com.
Thanks
Can you share a relevant code snippet or tutorial for adding webSocket Adapter to use Nakama real time chat?
On Sun, Oct 20, 2024 at 6:07 PM Mo Firouz @.***> wrote:
Closed #205 https://github.com/heroiclabs/nakama-js/issues/205 as completed.
— Reply to this email directly, view it on GitHub https://github.com/heroiclabs/nakama-js/issues/205#event-14750706353, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4MTIGQZBZSVKSD3W5HJLRLZ4OTKZAVCNFSM6AAAAABQIPKYKSVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUG42TANZQGYZTKMY . You are receiving this because you authored the thread.Message ID: @.***>
You can take a look at this adapter to add the NodeJS adapter.
I am new to Nakama. And I am trying to send message in a group. My code is: exports.sendGroupMessage = async (req, res) => { const errors = validationResult(req); if (!errors.isEmpty()) { return res.status(400).json({ errors: errors.array() }); }
};
But I am getting following error:
Failed to send group message: ReferenceError: WebSocket is not defined at WebSocketAdapterText.isOpen (D:\TechShield\Github\Nakama\NakamaApiRepo\NakamaApi\node_modules\@heroiclabs\nakama-js\dist\nakama-js.cjs.js:3319:70) at _DefaultSocket.connect (D:\TechShield\Github\Nakama\NakamaApiRepo\NakamaApi\node_modules\@heroiclabs\nakama-js\dist\nakama-js.cjs.js:3370:22) at exports.sendGroupMessage (D:\TechShield\Github\Nakama\NakamaApiRepo\NakamaApi\controller\api\ChatController.js:130:38) at Layer.handle [as handle_request] (D:\TechShield\Github\Nakama\NakamaApiRepo\NakamaApi\node_modules\express\lib\router\layer.js:95:5) at next (D:\TechShield\Github\Nakama\NakamaApiRepo\NakamaApi\node_modules\express\lib\router\route.js:149:13) at middleware (D:\TechShield\Github\Nakama\NakamaApiRepo\NakamaApi\node_modules\express-validator\lib\middlewares\check.js:16:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)