1 line
15 KiB
JSON
1 line
15 KiB
JSON
|
{"name":"Node-ipc","tagline":"Inter Process Communication Module for node using Unix sockets and servers. Giving lightning speed by bypassing the network card for local sockets and ipc.","body":"#node-ipc\r\n*a nodejs module for local and remote Inter Process Communication*\r\n\r\n**npm install node-ipc**\r\n\r\n*this is a new project so more documentation will come*\r\n\r\n----\r\n#### Types of IPC Sockets\r\n\r\n| Type | Definition |\r\n|-----------|------------|\r\n|Unix Socket| Gives lightning fast communication and avoids the network card to reduce overhead and latency. [Local Unix Socket examples ](https://github.com/RIAEvangelist/node-ipc/tree/master/example/unixSocket/ \"Unix Socket Node IPC examples\") |\r\n|TCP Socket | Gives the most reliable communication across the network. Can be used for local IPC as well, but is slower than #1's Unix Socket Implementation because TCP sockets go through the network card while Unix Sockets do not. [Local or remote network TCP Socket examples ](https://github.com/RIAEvangelist/node-ipc/tree/master/example/TCPSocket/ \"TCP Socket Node IPC examples\") |\r\n|TLS Socket | ***coming soon...*** |\r\n|UDP Sockets| Gives the **fastest network communication**. UDP is less reliable but much faster than TCP. It is best used for streaming non critical data like sound, video, or multiplayer game data as it can drop packets depending on network connectivity and other factors. UDP can be used for local IPC as well, but is slower than #1's Unix Socket Implementation because UDP sockets go through the network card while Unix Sockets do not. [Local or remote network UDP Socket examples ](https://github.com/RIAEvangelist/node-ipc/tree/master/example/UDPSocket/ \"UDP Socket Node IPC examples\") |\r\n\r\n----\r\n### IPC Default Variables \r\n\r\n``ipc.config`` \r\n\r\nSet these variables in the ``ipc.config`` scope to overwrite or set default values.\r\n\r\n {\r\n appspace : 'app.',\r\n socketRoot : '/tmp/',\r\n id : os.hostname(),\r\n networkHost : 'localhost',\r\n networkPort : 8000,\r\n encoding : 'utf8',\r\n silent : false,\r\n maxConnections : 100,\r\n retry : 500\r\n }\r\n\r\n| variable | documentation |\r\n|----------|---------------|\r\n| appspace | used for Unix Socket (Unix Domain Socket) namespacing. If not set specifically, the Unix Domain Socket will combine the socketRoot, appspace, and id to form the Unix Socket Path for creation or binding. This is available incase you have many apps running on your system, you may have several sockets with the same id, but if you change the appspace, you will still have app specic unique sockets.|\r\n| socketRoot| the directory in which to create or bind to a Unix Socket |\r\n| id | the id of this socket or service |\r\n| networkHost| the local or remote host on which TCP, TLS or UDP Sockets should connect |\r\n| networkPort| the default port on which TCP, TLS, or UDP sockets should connect |\r\n| encoding | the default encoding for data sent on sockets |\r\n| silent | turn on/off logging default is false which means logging is on |\r\n| maxConnections| this is the max number of connections allowed to a socket. It is currently only being set on Unix Sockets. Other Socket types are using the system defaults. |\r\n| retry | this is the time in milliseconds a client will wait before trying to reconnect to a server if the connection is lost. This does not effect UDP sockets since they do not have a client server relationship like Unix Sockets and TCP Sockets. |\r\n\r\n----\r\n\r\n#### IPC Methods \r\nThese methods are available in the IPC Scope. \r\n\r\n----\r\n##### log\r\n\r\n``ipc.log(a,b,c,d,e...);`` \r\n\r\nipc.log will accept any number of arguments and if ``ipc.config.silent`` is not set, it will concat them all with a sincle space ' ' between them and then log them to the console. This is fast because it prevents any concation from happening if the ipc is set to silent. That way if you leave
|