Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow named oob messages in ocap mode #25

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

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