sockplugin Code
Brought to you by:
meesisto
File | Date | Author | Commit |
---|---|---|---|
data | 2010-03-27 | meesisto | [r26] ci |
include | 2010-02-07 | meesisto | [r3] localize |
src | 2010-03-29 | meesisto | [r29] ci |
test | 2010-03-27 | meesisto | [r26] ci |
Makefile | 2010-03-27 | meesisto | [r26] ci |
README.txt | 2010-02-10 | meesisto | [r18] ci |
The intend of this plugin is to have debug output displayed in firefox, thus enable nice dhtlm features like folding/unfolding of nested blocks of the debug output. The plugin is based on the gecko sdk's modules/plugin/test/testplugin and is a dirty hack. Currently only Linux is supported. The plugin is targeting 2 scenarios: - communication using a named linux fifo - communication using sockets Named linux fifos: ------------------ create a named fifo in bash: $mkfifo /tmp/testfifo Embed the plugin object in your html file: For Firefox 3.5: <embed id="e1" type="application/y-test" width=100 height=100 pipe="/tmp/testfifo" ponread="receivedMsg" > For Firefox 2.0: Because NPN_PluginThreadAsyncCall() and NPN_ScheduleTimer() are not supported in Firefox 2.0 gtk's g_timeout_add() is used to shedule a callback in the GUI thread. You therefore need to compile the plugin with GTK. You will probably have to edit the Makefile's GTK_DIRS variable to point to your gtk files. <embed id="e1" type="application/y-test" width=100 height=100 async=0 wmode=window pipe="/tmp/testfifo" ponread="receivedMsg" > (note the async=0 and wmode=window) Each time somebody writes a string to /tmp/testfifo you'll get a message in javascript "receivedMsg(fd,msg)" Sockets: -------- For Firefox 3.5: <embed id="e1" type="application/y-test" width=100 height=100 > javascript: function onServerConnect(fd) { alert("onServerConnect:"+fd); } function receivedMsg(fd,msg) { $('#area').append(msg); } embed.startServer(5001,"onServerConnect" ,"receivedMsg") For Firefox 2.0: Add async=0 on the <embed> tag: <embed id="e1" type="application/y-test" width=100 height=100 async=0 wmode=window> (note the async=0 and wmode=window)