Giter Site home page Giter Site logo

primus / omega-supreme Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 9.0 184 KB

Omega supreme adds messaging between multiple primus servers. It needs a server address, spark id and message and the server will then send the correct message to the connected client.

License: MIT License

JavaScript 100.00%

omega-supreme's People

Contributors

3rd-eden avatar fadeenk avatar greenkeeper[bot] avatar lpinca avatar raulmt avatar trshafer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

omega-supreme's Issues

An in-range update of ws is breaking the build 🚨

The devDependency ws was updated from 6.1.0 to 6.1.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ws is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for 6.1.1

Bug fixes

  • Queued messages, when permessage-deflate is enabled, are now discarded if the
    socket closes prematurely (#1464, #1471).
Commits

The new version differs by 15 commits.

  • 029de0c [dist] 6.1.1
  • b213bee [pkg] Update list of published files
  • 95bf991 [pkg] Update dev dependencies
  • f26fac8 [minor] Ignore callbacks when clearing the send queue (#1471)
  • 5914206 [doc] Fix nits
  • 3fa0e03 [doc] Suggest implementation of heartbeat on the client (#1469)
  • 7d51fb9 [fix] Do not waste time compressing when socket is closed (#1464)
  • 1ebff19 [ci] Test on node 11
  • 7e061bc [pkg] Update nyc to version 13.1.0
  • bc0f8ab [pkg] Update eslint to version 5.8.0
  • 45f817b chore(package): update eslint-plugin-node to version 8.0.0 (#1466)
  • cddbcf6 [test] Remove unused variables
  • 0da3fdb [minor] Do not use the legacy URL API
  • d2317b1 [benchmark] Add Unix domain sockets to bench (#1456)
  • 9022a0d [doc] Remove clientMaxWindowBits option from README example (#1454)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

emit is not working as it is supposed to

server:

primus.forward.sparks([spark.id], {
  event: 'tonk',
  data: { name: 'sid' }
}, function (err, results) {
  Logger.infoc('In Tonk event: ' + JSON.stringify( results ));
});

on client:

primus.on('tonk', function (data) {
  console.error('Data on tonk: ' + data );
});

primus.on('data', function (data) { ... });
  • In my opinion, the tonk event handler should be called on client but instead the data event gets called. Is this known and intended behaviour?
  • Do I have to generate the event on client manually?
  • If I understood it correctly, will it (event generation) work on multiple sparks connected from separate clients (multiple hosts)?

individual responses instead of summary for .forward()

Currently, .forward() returns a single info object which is a summary of responses for all sparks. It does not indicate which particular spark(s) from the input list were sent to successfully.

Here is how it should be:

['L1mXUWv', 'L1mXUX9', '234fwfrewrw423#%#$']

So, if above is the input list of sparks and assuming that 3rd item is invalid/disconnected/non-existent, the output should be similar to:

[ 'ok','ok',null ]

So, client could store the ACKs at some place and re-attempt the ones that failed (for any reason).

Just to be doubly sure, index of results must match the corresponding sparks in input list.

Edit:
Another option is to extend the 'info' object by adding 'sparks' array that is a list of spark(s) where msg was successfully sent.

Example: { ok: true, send: 2, sparks:['L1mXUWv', 'L1mXUX9'] }

An in-range update of ws is breaking the build 🚨

The devDependency ws was updated from 7.0.0 to 7.0.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ws is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).
  • βœ… coverage/coveralls: First build on greenkeeper/ws-7.0.1 at 100.0% (Details).

Commits

The new version differs by 9 commits.

  • 38d3bf2 [dist] 7.0.1
  • a0af764 [test] Use the correct value for the Content-Length header
  • b086179 [fix] Allow to disable sending the SNI extension (#1587)
  • e9e8ba5 [pkg] Update eslint-config-prettier to version 5.0.0 (#1588)
  • 36ef757 [doc] Add missing dependency in code snippet (#1581)
  • 911bb6f [minor] Fix typo in JSDoc comment (#1565)
  • 8050d5f [lint] Enable quotes rule
  • 995c527 [test] Enable --throw-deprecation
  • fbc077b [test] Do not use the deprecated outgoingMessage._headers property

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

security update required for lodash dependency

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ high          β”‚ Prototype Pollution                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Package       β”‚ lodash                                                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Patched in    β”‚ >=4.17.11                                                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Dependency of β”‚ omega-supreme                                                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Path          β”‚ omega-supreme > async > lodash                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ More info     β”‚ https://nodesecurity.io/advisories/782                       β”‚

yarn audit ^^
I have 3.0.0 of omega supreme installed

Primus and omega supreme

Trying primus 3.2.0 and omega supreme 2.0.0

I get error when I try

primus.use('omega-supreme', require('omega-supreme'))

Error:
chat-api/node_modules/primus/index.js:689
throw new PrimusError('The plugin name was already defined', this);
^
PrimusError: The plugin name was already defined

then I try it as a plugin:

primus.plugin('omega-supreme', require('omega-supreme))

Another error comes up:
/chat-api/node_modules/bluebird/js/main/async.js:43
fn = function () { throw arg; };
^
TypeError: primus.forward is not a function

It seems primus does not have forward method from the omega-supreme plugin.
Could you please help me?
Thanks

primus.forward shouldn't answer with error for empty servers list

primus/metroplex adds the broadcast function to primus.forward, which just gathers all servers in the metroplex registry and calls primus.forward. But there is a problem when you want to boradcast and the only server available is the current one processing the forward.broadcast call: metroplex.servers will return empty list (since it ignores current server) and it will call forward with an empty list.

The problem is even when forward will do everything you would expect (passing the message to every spark on the current server) it will still call the callback with an error saying "No servers provided". So the broadcast will also fail, even considering the scenario is not something unusual (a cluster of current size 1, maybe because you don't need too much servers at the moment or you want a cluster setup in case you need to add more nodes).

At first I thought this should be primus/metroplex 's problem, but looking at the code there is not much you can do there… if you don't call forward you won't deliver the message to the sparks on the current server, and you won't have the stats you need to answer with. And if you do add the current server to the servers provided to forward, then for a broadcast type of message it will still call the current server even when all messages were locally delivered.

So, the only solution I can think of is to not answer with error in primus.forward for empty servers list. It kind of makes sense to me for the fact this function will always try to deliver to local sparks… so having empty servers list is like saying "please forward to local clients". An alternative would be to have a special parameter or another function that will allow you to only deliver to local sparks, so in metroplex you can call it instead of forward if you see there are no other servers but this one (although I think it's better to just support empty servers list because of the job done in forward).

Does this make sense? I can submit a PR if it does, but I would like some advice on the best solution to this unexpected error.

Question: Forward to multiple servers?

Hi there,

Quickly going through this I didn't see any mention that this plugin can forward messages to multiple other servers and I'd just like to confirm this is the case? I'm on a project where having a Redis instance isn't as great an option as this idea, but can be done if needed.

Thanks,

Steve

Disconnect specific spark ID on a different instance

Is it possible to disconnect a specific spark ID on a different instance using metroplex and omega-supreme?

e.g. you could do this using primus.spark(id).end() if the spark was connected to the same instance

Compatability with primus-emit

I've just managed to wire omega-supreme up with metroplex to get a proof of concept for horizontal scaling (aside: brew install redis gives me v2.4 which doesn't support the SCRIPT command which I believe metroplex needs...).

Anyway, I was using primus-emit and nothing was working. So I started spurlunking omega.js and changed the code to use vanilla on('data', fn) and write(data) which then got everything working.

What's required to get this to work with emit? (I'll keep digging too)

An in-range update of mocha is breaking the build 🚨

Version 5.0.1 of mocha was just published.

Branch Build failing 🚨
Dependency mocha
Current Version 5.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details
  • βœ… coverage/coveralls First build on greenkeeper/mocha-5.0.1 at 100.0% Details

Commits

The new version differs by 15 commits.

  • 09ce746 Release v5.0.1
  • 70027b6 update changelog for v5.0.1 [ci skip]
  • 44aae9f add working wallaby config
  • 412cf27 [Update] license year
  • b7377b3 rename help-wanted to "help wanted" in stale.yml
  • d975a6a fix memory leak when run in v8; closes #3119
  • 3509029 update .gitignore to only ignore root mocha.js [ci skip]
  • b57f623 fix: When using --delay, .only() no longer works. Issue #1838
  • cd74322 Slight copy update on docs for test directory
  • f687d2b update docs for the glob
  • 14fc030 Add all supported wallaby editors
  • 2e7e4c0 rename "common-mistake" label to "faq"
  • bca57f4 clarify docs on html, xunit and 3p reporters; closes #1906
  • 2fe2d01 Revert "fix travis "before script" script"
  • c0ac1b9 fix travis "before script" script

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.