{"id":234189,"date":"2025-06-03T10:24:27","date_gmt":"2025-06-03T10:24:27","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/ns-chat\/"},"modified":"2025-09-23T06:35:47","modified_gmt":"2025-09-23T06:35:47","slug":"ns-chat","status":"publish","type":"plugin","link":"https:\/\/szl.wordpress.org\/plugins\/ns-chat\/","author":23292035,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.1","stable_tag":"1.0.1","tested":"6.8.5","requires":"5.8","requires_php":"7.4","requires_plugins":null,"header_name":"NS Chat","header_author":"Sergey Ivanov","header_description":"Real-time WebSocket chat for WordPress using Workerman. Supports private messaging, unread indicators, and future file transfer.","assets_banners_color":"","last_updated":"2025-09-23 06:35:47","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/wordpress.org\/plugins\/ns-chat\/","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":0,"downloads":384,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0":{"tag":"1.0","author":"nsgroup","date":"2025-06-06 12:29:17"},"1.0.1":{"tag":"1.0.1","author":"nsgroup","date":"2025-09-23 06:35:47"}},"upgrade_notice":{"1.0":"<p>First version. Set up the server manually if using on production.<\/p>","1.0.1":"<ul>\n<li>Fix: WebSocket auth via WordPress cookie; reliable user_id extraction in CLI worker.<\/li>\n<li>Fix: No duplicate message for sender (no-echo from server).<\/li>\n<li>Fix: Suppress REQUEST_METHOD notice in CLI by setting minimal $_SERVER vars.<\/li>\n<li>Improve: Domain detection for WS (nschat_data.domainName) with safer fallback.<\/li>\n<\/ul>","Upcoming":"<p>Planned support for:\n- Message editing and deletion\n- Read receipts\n- File upload\/download via NFS or AWS<\/p>"},"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3305624,"resolution":"128x128","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1"],"block_files":[],"assets_screenshots":[],"screenshots":{"1":"Messaging interface","2":"Room list with unread indicators","3":"Admin-side chat view (future)"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[5707,2512,866,190408,243324],"plugin_category":[41],"plugin_contributors":[243325],"plugin_business_model":[],"class_list":["post-234189","plugin","type-plugin","status-publish","hentry","plugin_tags-chat","plugin_tags-messaging","plugin_tags-real-time","plugin_tags-websocket","plugin_tags-workerman","plugin_category-communication","plugin_contributors-sergey-ivanov","plugin_committers-nsgroup"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/ns-chat\/assets\/icon-128x128.png?rev=3305624","icon_2x":false,"generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>NS Chat Plugin enables real-time communication between WordPress users using WebSocket technology, powered by the Workerman library.<\/p>\n\n<p>Key Features:\n* Real-time private chat between users\n* Visual unread message indicators\n* Persistent chat history stored in the database\n* Lightweight modular JS + PHP architecture\n* Automatic migration and sync of WP users to chat system\n* Linux daemon service with SSL support for secure connections\n* Future-ready integration with NFS or AWS S3 for file upload\/download<\/p>\n\n<p>Planned Features:\n* Message editing and deletion\n* Read receipt indicators (message seen)\n* File attachments with optional NFS or AWS S3 integration<\/p>\n\n<p>Ideal for community websites, intranets, or any platform requiring internal messaging without third-party services.<\/p>\n\n<p><strong>For integration help or consulting on adapting the plugin to your project, contact the developer at: ns.group.tech@gmail.com<\/strong><\/p>\n\n<h3>WebSocket Server Setup (Linux with SSL)<\/h3>\n\n<ol>\n<li><p><strong>Create a systemd service file:<\/strong>\n<code>bash\nsudo vim \/etc\/systemd\/system\/websocket_server.service<\/code><\/p><\/li>\n<li><p><strong>Paste the following content:<\/strong>\n<code>bash\n[Unit]\nDescription=WebSocket Server for NS Chat (SSL)\nAfter=network.target\n[Service]\nExecStart=\/usr\/bin\/php \/file\/to\/path\/yourdomain\/wp-content\/plugins\/ns-chat\/server.php start\nRestart=always\nRestartSec=25\nUser=www-data\nGroup=www-data\nStandardOutput=file:\/var\/log\/websocket_server.out.log\nStandardError=file:\/var\/log\/websocket_server.err.log\n[Install]\nWantedBy=multi-user.target<\/code><\/p><\/li>\n<li><p><strong>Add SSL context in <code>server.php<\/code>:<\/strong>\n<code>php\n$context = [\n'ssl' =&gt; [\n    'local_cert'  =&gt; '\/path\/to\/file.crt',\n    'local_pk'    =&gt; '\/path\/to\/file.key',\n    'verify_peer' =&gt; false,\n]\n];<\/code><\/p><\/li>\n<li><p><strong>Set permissions for plugin folder:<\/strong>\n<code>bash\nsudo chown -R www-data:www-data \/path\/to\/ns-chat\/\nsudo chmod -R 775 \/path\/to\/ns-chat\/<\/code><\/p><\/li>\n<li><p><strong>Reload and start the daemon:<\/strong>\n<code>bash\nsudo systemctl daemon-reload\nsudo systemctl enable websocket_server --now\nsudo systemctl restart websocket_server\nsudo systemctl status websocket_server<\/code><\/p><\/li>\n<li><p><strong>Check logs if needed:<\/strong>\n<code>bash\n\/var\/log\/websocket_server.out.log\n\/var\/log\/websocket_server.err.log<\/code><\/p><\/li>\n<\/ol>\n\n<h3>Custom Port Configuration<\/h3>\n\n<p>By default, the WebSocket server listens on <strong>port 2346<\/strong>.<\/p>\n\n<p>To use a different port:<\/p>\n\n<ol>\n<li>Change the port in <code>server.php<\/code>:\n<code>php\n$wsWorker = new Worker('websocket:\/\/0.0.0.0:2346', $context);<\/code><\/li>\n<li><p>Change the port in <code>ns-chat.php<\/code>:\n<code>php\n$ws_port = 2346;<\/code><\/p><\/li>\n<li><p>You can check and change the port in <code>chat-ui.js<\/code>:\n<code>js\nconst port   = nschat_data.wsPort || 2346;<\/code><\/p><\/li>\n<li><p>If the port is closed, then open a new port on your server's firewall:\n<code>bash\nsudo ufw allow &lt;your-port&gt;\/tcp\nsudo firewall-cmd --permanent --add-port=&lt;your-port&gt;\/tcp\nsudo firewall-cmd --reload\nsudo iptables -A INPUT -p tcp --dport &lt;your-port&gt; -j ACCEPT\nsudo iptables-save &gt; \/etc\/iptables\/rules.v4<\/code><\/p><\/li>\n<\/ol>\n\n<h3>Database Tables<\/h3>\n\n<p>The plugin creates and uses the following tables:<\/p>\n\n<ul>\n<li><code>wp_ns_chat_dialogues<\/code><\/li>\n<li><code>wp_ns_chat_messages<\/code><\/li>\n<li><code>wp_ns_chat_users<\/code><\/li>\n<\/ul>\n\n<p>Tables are created and populated automatically on plugin activation.<\/p>\n\n<h3>User Synchronization<\/h3>\n\n<ol>\n<li><strong>Initial migration<\/strong> of all users from <code>wp_users<\/code> to <code>wp_ns_chat_users<\/code> on plugin activation.<\/li>\n<li><strong>New registrations<\/strong> are handled by:\n<code>php\nadd_action('user_register', 'ns_chat_add_user_on_registration');<\/code><\/li>\n<li><strong>Profile updates<\/strong> are synced via:\n<code>php\nadd_action('profile_update', 'ns_chat_update_user_data');<\/code>\nYou may bind these functions to custom hooks based on your app\u2019s logic.<\/li>\n<\/ol>\n\n<h3>License<\/h3>\n\n<p>GPLv2 or later<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the plugin folder <code>ns-chat<\/code> to <code>\/wp-content\/plugins\/<\/code>.<\/li>\n<li>Activate the plugin through the \u2018Plugins\u2019 menu in WordPress.<\/li>\n<li>After activation, a new page template called \"NS Chat Template\" will be available when creating pages.<\/li>\n<li>Set up the WebSocket server on your Linux machine.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='does%20this%20work%20on%20shared%20hosting%3F'><h3>Does this work on shared hosting?<\/h3><\/dt>\n<dd><p>No, it requires a persistent PHP process for the WebSocket server. Use a VPS or dedicated server.<\/p><\/dd>\n<dt id='is%20ssl%20required%3F'><h3>Is SSL required?<\/h3><\/dt>\n<dd><p>Yes. To use secure WebSocket (wss:\/\/), SSL certificates must be configured in <code>server.php<\/code>.<\/p><\/dd>\n<dt id='can%20i%20use%20a%20different%20port%20than%202346%3F'><h3>Can I use a different port than 2346?<\/h3><\/dt>\n<dd><p>Yes. See \"Custom Port Configuration\" section.<\/p><\/dd>\n<dt id='can%20i%20get%20help%20with%20integration%20into%20my%20custom%20project%3F'><h3>Can I get help with integration into my custom project?<\/h3><\/dt>\n<dd><p>Yes, you can contact the developer at ns.group.tech@gmail.com for custom integration support or consulting.<\/p><\/dd>\n<dt id='does%20it%20support%20group%20chats%3F'><h3>Does it support group chats?<\/h3><\/dt>\n<dd><p>Not yet. Planned in future versions.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial public release.<\/li>\n<li>One-on-one messaging with WebSocket daemon<\/li>\n<li>User sync and message storage<\/li>\n<\/ul>","raw_excerpt":"Real-time WebSocket chat for WordPress with user sync and message history.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/234189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=234189"}],"author":[{"embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/nsgroup"}],"wp:attachment":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=234189"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=234189"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=234189"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=234189"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=234189"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=234189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}