Line 4: |
Line 4: |
| | | |
| [[User:Filfat|Filfat]] ([[User talk:Filfat|talk]]) 11:27, 13 January 2017 (CST) | | [[User:Filfat|Filfat]] ([[User talk:Filfat|talk]]) 11:27, 13 January 2017 (CST) |
| + | |
| + | == Websession proposed changes == |
| + | |
| + | I tried edit the page but ends considered being spam |
| + | These are the changes I want do |
| + | |
| + | |
| + | |
| + | |
| + | Next info was tested in 9.0.0 |
| + | |
| + | In the js side, there is a method called <code>window.nx.sendMessage(arg)</code> that sends data to the native side, this method returns a boolean indicating if sending was succesful and accepts a string as an argument. The string is encoded like a C null terminated string in the message content. For receive messages from native part, there is a dom event called <code>message</code> which is dispatched when a message arrives. The event can be listened using <code>window.nx.addEventListener("message", callback)</code> being callback a function which first parameter is like a dom event arg and contains a member called <code>data</code> which contains the string decoded from the arrived message |
| + | |
| + | If messages aren't acked by the native part, js side will not longer receive messages. Ack to web applet '''must''' have 4 bytes after the message content or will crash. |
| + | |
| + | ==== SessionMessage ==== |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! Offset |
| + | ! Size |
| + | ! Description |
| + | |- |
| + | | 0x0 |
| + | | 0x10 |
| + | | [[#SessionMessageHeader]] |
| + | |- |
| + | | 0x10 |
| + | | Size from header |
| + | | Message content |
| + | |- |
| + | | After message content |
| + | | 0x4 if message is ack, 0x0 otherwise |
| + | | Padding |
| + | |} |
| + | |
| + | ==== SessionMessageHeader ==== |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! Offset |
| + | ! Size |
| + | ! Description |
| + | |- |
| + | | 0x0 |
| + | | 0x4 |
| + | | Message ID |
| + | |- |
| + | | 0x4 |
| + | | 0x4 |
| + | | Content size following the header. |
| + | |- |
| + | | 0x8 |
| + | | 0x8 |
| + | | Unused |
| + | |} |
| + | |
| + | ==== IDs ==== |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! ID |
| + | ! Content size |
| + | ! Description |
| + | |- |
| + | | 0x0 |
| + | | Arbitrary |
| + | | Arbitrary content. Used to communicate with the applet via JsExtensions used by the Js being run by the applet on the current page. |
| + | |- |
| + | | 0x1000 |
| + | | 0xc |
| + | | Ack. Content: first u32 is the entire storage size of the message being acked, the rest is not used. |
| + | |} |
| + | |
| + | |
| + | [[User:Amicuchu|Amicuchu]] ([[User talk:Amicuchu|talk]]) 16:43, 5 January 2020 (UTC) |