port.ref()
unref() 的相反操作。在先前被 unref() 的端口上调用 ref() 不会让程序在这是唯一剩下的活动句柄时退出(这是默认行为)。如果端口已经被 ref(),再次调用 ref() 不会有任何效果。
【Opposite of unref(). Calling ref() on a previously unref()ed port does
not let the program exit if it's the only active handle left (the default
behavior). If the port is ref()ed, calling ref() again has no effect.】
如果使用 .on('message') 添加或移除监听器,则根据事件是否存在监听器,端口会自动被 ref() 和 unref()。
【If listeners are attached or removed using .on('message'), the port
is ref()ed and unref()ed automatically depending on whether
listeners for the event exist.】