We were previously using 8.0.8 using websockets / faye.
Our client application is not hosted by the node.js / actionhero server, but is independent and so has a different URL and port. We were previously connecting to Faye directly and sending commands there.
I am attempting to migrate our project to 9.0.0:
I have the server up and running and am attempting to use the actionheroClient.js remotely rather than learning Primus and modifying our client script accordingly.
I set the clientUrl in config/servers/websocket.js to https://ourdomain:8080
After I issue client.connect() I tried to send a
client.action("actionsView", function(data){ console.log(data); }) like in your example,
however the browser console shows that the command is being sent to
https://ourdomain/NaN?action-actionsView&
Am I doing something obviously stupid here?
Being unfamiliar with the actionheroClient library is probably not helping me.
I am also curious if the commented out options in config/servers/websocket.js from 9.0.0 are supposed to be that way. For instance, uncommenting "transformer: 'ws'," throws the following error:
Primus:
Primus: Unsupported transformer: "ws"
Primus: We only support the following transformers:
Primus:
Primus: websockets, engine.io, socket.io, browserchannel, sockjs
Primus:
Thanks,
Dj
apiPath: '/api',
host: 'https://ourdomain:8080',
I do not see these options in my freshly generated test project, so I am wondering if I am supposed to set this stuff up elsewhere, or am I going about this the wrong way?
To see if it was a cross domain issue, I updated to 9.0.1 and moved my client to be hosted in the public folder of actionhero rather than externally and I am not having much of a different experience with either websockets or sockjs transports, neither of them seem to connect by ws and does the fallback method.
I see a readyState of 3 for the connection and then switch protocol notice in the network console, so I assume thats where its failing the wss connection and falling back to post.
I am going to continue to see if I can get it working, my post was basically I just wanted to know if I am doing anything obviously wrong with regards to using the client library as I mentioned we had our own client library previously.
I am not sure what all needs to be uncommented with regards to the server options for Primus in websocket.js config. Does anything need to be uncommented for basic functionality?
I had assumed the commented out options were the defaults, however if I uncomment "headers: false" for instance, the server will not start with this error:
/server2/node_modules/actionhero/node_modules/primus/node_modules/access-control/index.js:62
, headers = options.headers.toLowerCase().split(',')
^
TypeError: Object false has no method 'toLowerCase'
--
You received this message because you are subscribed to the Google Groups "actionHero.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionhero-j...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think the consensus was that some of the naming from your client script was conflicting with internal stuff from our project as ultimately our original client library was based on your old faye library so it had some of the same naming conventions.
I did want to make a note in "fallback" mode, I think something is still missing from the options, as I would have like domain/undefined/action?whatever in the request.
In reference to your comments above, I think you should leave the commented out options, however as I mentioned above, I was expecting the commented out options to be *working* defaults. Uncommenting a line and having the project break was a bit confusing having no previous knowledge of Primus.
The whole reason I chose to use the built in client library was so I didn't have to learn Primus in the first place. I like this project because its easy to get up and going and add new actions and initializers, so I don't think the majority of people that use this client library want to go read a bunch of Primus documentation just to figure out why their project breaks when something in the generated project is uncommented is all.