Due to restrictions on node.js versions, recent versions of Meteor cannot be used on the system. A DDP server has to be created using regular node.js instead, which a Meteor setup will connect to.
DDP client can be created in node.js using node-ddp-client, but how can we create a DDP server?
It might be too late to answer this and this might not be a good answer anyway. It's not an easy task, we need to manage sessions, users, methods, publications... As a reference for a brave developer :)
We need EJSON or some other implementation to serialize and deserialize messages between client and server.
We need a socket server (sockjs would be a good choice since meteor is using it too.)
We need to implement DDP specification
I've found https://www.npmjs.com/package/ddp-server-reactive and https://www.npmjs.com/package/ddp-server which both seem to do the job
Related
I seem to be confused by conflicting sources, yesterday I was reading the node docs and was sure Node's 'net' and 'http' modules had web socket capabilities, but maybe I misunderstood the documentation because today an article said that node has no built in web socket support.
Can you create a node server that can handle web socket connections with just node and javascript, no external libraries?
Node does not have native support for websockets like it does for http or tcp (net) connections.
It's been discussed a few times, and rejected for various reasons of the last few years. The current discussion is going on here: https://github.com/nodejs/node/issues/19308
You can, of course, implement a websocket server yourself using the native modules, but you'll need to do a lot of boilerplate work.
To see both an example of what you'd need to do to implement your own websocket server using node and a good pre-built library you can use to work with websockets in node, I would reccomend taking a look at: https://github.com/websockets/ws
Sure, you could... if you re-implemented the functionality from those Web Socket libraries yourself.
The Node.js core libraries are minimal. They're only intended to cover the basics needed to function, and the most common use cases. As much functionality as possible is left to modules outside of the Node.js core. This is a very intentional design.
It would be incredibly irresponsible to implement your own Web Socket library without a very good reason. You should rethink why you don't want to use existing libraries.
I'm working on a simple game, that needs to use Web Sockets. I have read that DDP should be the way to go, as it's what Meteor uses.
I can't find any documentation regarding it tho, except the note on Meteor.com.
Should I use sock js instead, or how can I use the DDP package?
DDP is a protocol that can run on top of sockets. It's not a socket library in itself. If you really need your own socket communication, then use socket.io or look for packages that do that on atmosphere. There have been some attempts made (e.g., http://arunoda.github.io/meteor-streams/), but I'm not sure what the latest is on that. This might work for you: https://github.com/joncursi/socket-io-client
Is there a way to use AMQP to communicate with RabbitMQ over WebSockets?
I guess the real question is if there is support for this in RabbitMQ and if there are any client side libraries for the browser? Can not really wrap my mind around it and google provides no answers for me.
Today we are using the RabbitMQ STOMP-SockJS solution. But that does not work very well with LVC (Last Value Cache) and exchanges other than the default. Since it does not allow to bind multiple routing keys to the same queue. (It automatically creates a new queue for each subscription.)
The best (most flexible, scalable, secure, etc) way to do this in my experience is to build a web server for your WebSockets and have the web server communicate with RabbitMQ.
Kaazing has an AMQP JavaScript API that works with one of RabbitMQ's implementations of AMQP. Its free for developers and can be downloaded here
Full disclosure: I work for Kaazing.
I am looking to be able to access a Couchbase instance via Javascript. My intent is to use Couchbase as the backend for a Qooxdoo JSON datastore. I understand that Couchbase has a RESTful interface but, eventually, I'll need to wrap security and some other functions, so I'm guessing that a direct connection will not meet my requirements.
So, my question is, what would be the best way to do this? Sounds like a proxy server built around an existing Couchbase client is the way to go, but I'm open to suggestions. I'm looking for light-weight and fast.
Thanks!
There is nginx module built which allows to access couchbase over HTTP http://labs.couchbase.com/couchbase-nginx-module/
So you can expose your storage and use authentication schemes provided by other nginx modules.
Oh, and also there is REST wrapper written in ruby https://github.com/couchbaselabs/couchbase-rest-api-rails
I'm thinking about how limiting it is for AJAX apps to have to poll for updates, when what would be ideal is for javascript to be able to set up a real two way connection to the server. I'm wondering if there is some method of integrating javascript with a browser plugin that can make a tcp connection so that I could pass data into and out of the browser plugin.
WebSockets is designed to solve this problem.
Here is an implementation with a similar approach:
socketjs
It uses a Java Applet and bridges its API to JavaScript, interesting...
And here another one:
jSocket
This one is a wrapper of the Actionscript 3 Socket API, bridged to JavaScript...
You can use node.js framework's socket.io package which can can be installed via npm (A node package manager).
More detailed usage.
jSocket and Stream are two options that utilize Flash's built-in XML sockets, though neither appears to be production-ready. I'd lean towards using a Flash-based solution rather than Java, as browser penetration is higher and generally offers a better user experience (load times & stability).