Coder Social home page Coder Social logo

postal.request-response's People

Contributors

ifandelse avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

postal.request-response's Issues

Correct way to ES6 import this

I'm currently using require('postal.request-response')(require('postal')) to include the module but this seems to fail with webpack for some reason.

So excuse me if this is obvious but what's the way to use ES6 import with this? I can't seem to find the right combination so that postal itself is included.

Promises on .request and node-style callbacks on .reply is unbalanced

The API is confusing.

Using promises is lovely, but envelope.reply appears to be a node-style callback.

I was actually bitten by this, I expected .reply to simply accept my data and ended up having to dig up where an error Firefox couldn't print was coming from.

I would recommend an alternative to .reply that simply accepts a value, paired with another that accepts an error.

Adding user not working

Hello,

When adding a admin or non-admin user to the portal, the invite mail is not being send (the button Add User keeps spinning after you click it).
This means that users will never be added to the portal.

image

This is not really an issue but don't know where I should put it instead.

It would be nice to have similar features like for example SendinBlue.

  • Able to automatically gain or loose reputation based on SPAM reports or bounced messages (this will make the user be able to send more or less emails per hour).
  • Just like SendGrid and SendinBlue give users their own credentials so they have their own enviroment (don't know if it is already like this because I'm not able to add users).

Revising the implementation

@ifandelse Is there anyway the implementation could be changed to the following:

postal.publish({
    channel: 'some.channel',        
    request: {
        topic: 'some.topic',
        data: {some: data},
        timeout: 2000
    },
    response: {
        onSuccess: function (d, e) { }
        onFail: function (err) { }
        always: function (d, e, err) { }
    }
});

The problem I'm having with the current implementation is that it introduces a whole new approach to publishing by having to work with the channel itself. The approach is different, and yet, fundamentally, there's nothing particularly different about request-response.

Also, I think the then should be internalized (but still conform to the configuration for creating promises, of course). Further, onSuccess, onFail, and always conform to the language of the promises domain.

The approach I take above is crystal clear, and we stay within the confines of how we publish otherwise.

It seems to me that it should be easy enough to ingest the object literal above (request, response), and then wrap the channel in request semantics. The response callbacks could internally be mapped to then. So, in effect, the approach I take above becomes sugar on top of the current implementation.

I do like the subscriber side, though (i.e. envelope.reply({ })).

Just some suggestions...

update dependency on lo-dash and compatible postal version

Thanks for the great plugin, it is very useful! It helped me avoid a much more code heavy tight-augmentation approach. This plugin works with the latest version of postal.js (1.0.2) - any reason the dependency should not be updated? Also, is there really a need to declare a dependency on lo-dash when it's just a pass-through and given postal.js already declares a dependency on lo-dash? Happy to submit a pull request.

Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': An object could not be cloned.

Just as a reference. When used in combination with postal.js(1.0.6), postal.xframe(0.3.2) and postal.federation(0.2.4) the following error is thrown in the default configuration.

Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': An object could not be cloned. in postal.xframe line 109.

Looks like the .reply method added to the envelope causes this issue.

This can be fixed by setting

postal.fedx.transports.xframe.configure({ safeSerialize: true });

Register one listener at a time

First of all,
thanks for postal.js.

I took a look at postal.request-response code and I couldn't find any constraint related to the number of listeners. I think this number should be limited to one at a time. Do you agree? Did I overlook something?

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.