= [[wsgw|WebSocket Gateway (wsgw) Support]] = == [[Launching wsgw at boot]] == === Mac OS X === If you haven't done so yet, you'll want to first [[build|Building Pianod]] and install the gateway. ==== Launching at Login ==== With Finder, in your home (named for you) folder, open Library. If you don't see Library, hold Option and click Finder's "Go" menu; Library should appear in there. Inside Library, create a folder named LaunchAgents. Using your favorite texte editor, create com.deviousfish.wsgw.plist in LaunchAgents with the document below. TextEdit can be used for this, but you must set Format->Make Plain Text mode. As supplied, this is configured to work with pianod. This will need to be revised to work with other services; see the wsgw man page for more information. '''pianod launchd.plist for OS X 10.5 or later'''





	KeepAlive
	
	Label
	com.deviousfish.wsgw
	ProgramArguments
	
		/usr/local/bin/wsgw
		pianod,localhost,4445,text
	
	RunAtLoad
	


pianod should now launch automatically next time you login. You can start it now with this Terminal command:

launchctl load ~/Library/LaunchAgents/com.deviousfish.wsgw.plist
==== Launch at Boot ==== To launch at boot, as administrator (sudo vi or such) create /Library/LaunchDaemons/com.deviousfish.pianod.plist:





	KeepAlive
	
	Label
	com.deviousfish.wsgw
	ProgramArguments
	
		/usr/local/bin/wsgw
		pianod,localhost,4445,text
	
	RunAtLoad
	
	UserName
		nobody


Note the addition of the UserName key, which prevents the gateway from running as root (administrator) unnecessarily.