Skip to content

Conversation

@gordonwoodhull
Copy link
Contributor

Rserve now supports direct input through the oob message "console.in". However, rserve.js disables named oob messages when in ocap_mode.

This PR is an attempt to fix that. I still want to test it further, but I thought I would open the PR now to make sure I am not breaking the design of rserve.js somehow.

+@s-u

Details below from commit message:

instead of switching on opts.ocap_mode, switch on the type of the wrapped
payload's first element:

  1. if it's a string, check if on_oob_message supplied. if so, call it
    with the usual function(error, result) callback.

NOTE: the signature was the opposite before, function(message, error),
so this is a breaking change! but (error, result) is the standard
asynchronous javascript signature, so i think this is correct.

  1. if it's a function, make sure we are in ocap mode. if so, call the function
    exactly as before.
  2. if it's anything else, report "Unknown oob message type".

instead of switching on opts.ocap_mode, switch on the type of the wrapped
payload's first element:

1. if it's a string, check if on_oob_message supplied. if so, call it
with the usual function(error, result) callback.

NOTE: the signature was the opposite before, function(message, error),
so this is a breaking change!  but (error, result) is the standard
asynchronous javascript signature, so i think this is correct.

2. if it's a function, make sure we are in ocap mode. if so, call the function
exactly as before.

3. if it's anything else, report "Unknown oob message type".
gordonwoodhull added a commit to att/rcloud that referenced this pull request Jan 20, 2015
- enable the feature in rserve.conf
- add handler for on_oob_message
- add new (empty) block of message handlers in session.js
- include refactor of oob message code in cscheid/rserve-js#25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant