Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Maximilian Grundke
    @Parnswir
    on a side note: in the readme, there is a call to $websocketBackend.mock(); which is non-existant
    ```$websocketBackend = {}
    beforeEach ->
        angular.mock.module('ngWebSocket', 'ngWebSocketMock')
    
        inject (_$websocketBackend_) ->
            $websocketBackend = _$websocketBackend_
    this is the code I use to initialize the mock
    in a test, I use it like this:
        $websocketBackend.expectSend("""{"id": 1,.....}""")
        $websocketBackend.flush()
    Maximilian Grundke
    @Parnswir
    but this only leads to the following output:
    Error: Requests waiting to be flushed
    I am certain, that send is called by the tested module
    Maximilian Grundke
    @Parnswir
    for some context: I use karma + jasmine with both PhantomJS and Chrome
    Maximilian Grundke
    @Parnswir
    Please correct me if I'm wrong: $websocketBackend.send() is never fired, because $websocketMock.readyState is undefined, so the while-loop in $WebSocket.fireQueue() does not run with mocked WebSockets
    So, adding $MockWebSocket.prototype.readyState = 1; allows calling $MockWebSocket.prototype.send
    Maximilian Grundke
    @Parnswir
    the next issue is with $WebSocketBackend.flush(), in wich (pending.message === msg.message) seems to be (undefined === undefined) in my case, even though pendingSends and sendQueue do contain the sent and expected strings
    removing both .message works as expected in the tests (i.e. really compares expected and sent string)
    Maximilian Grundke
    @Parnswir
    is somebody actually reading this? ;-)
    PatrickJS [tipe.io]
    @gdi2290
    @Parnswir yeah sorry I’ve been busy
    Brian Topping
    @briantopping
    hi, what's the fastest way to get an example running after checking out from git? would be cool to have a tl;dr for just running it.
    Brian Topping
    @briantopping
    Oh, the demo talks to echo.websocket.org, nm
    PatrickJS [tipe.io]
    @gdi2290
    @briantopping yeah that’s a good idea. I need to update the repo with breaking api changes so it works for both angular1 and angular2
    Brian Topping
    @briantopping
    @gdi2290 is angular2 worth using yet?
    PatrickJS [tipe.io]
    @gdi2290
    @briantopping for production not at all but for small toy/example apps to check it out it’s fun
    Brian Topping
    @briantopping
    cool, thanks! :)
    davetclark
    @davetclark
    Is there a bower packer for angular-websocket-mock, or is that only in npm?
    PatrickJS [tipe.io]
    @gdi2290
    @davetclark you should be able to get it when you bower install angular-websocket
    Nate Dudenhoeffer
    @AgDude
    You asked for some feedback on the api, I just started using the library, and the api seems ok, but I am not crazy about the architecture of the main provider.
    What I want to do is decorate the _onMessageHandler, and it seems that has been made entirely private, so I really can't.
    In my use case, we have decided we will only send JSON and heartbeat messages in our app, so I would like to parse all data to JSON once, before calling my registered handlers.
    Henry Hz
    @henry-hz
    hi there, please, does it work with 3 way databinding as a firebase/meteor style ?
    Luke Browell
    @lukebrowell
    @gdi2290 It's great that you're looking at this. So many of us are rolling our own with socket.io right now, that when your plans for socket.io integration land it will be a real selling point.
    PatrickJS [tipe.io]
    @gdi2290
    I'm planning on rebuilding this to work for both Angular1 and Angular2 with a way to easily support any other integrations
    telvin
    @telvin
    WebSocket connection to 'ws://abc.com' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
    MILLER/F
    @millerf
    Guys, in the presentation of the WebsocketMock, there is a parenthesis missing:
    var $websocketBackend;
    beforeEach(angular.mock.module('ngWebSocket', 'ngWebSocketMock');
    MILLER/F
    @millerf
    Guys, I really have trouble creating tests.

    describe('Websocket', function () {

    //load module
    beforeEach(module('mozaik'));

    var $websocketBackend, createController;
    beforeEach(angular.mock.module('ngWebSocket', 'ngWebSocketMock'));

    beforeEach(inject(function ($websocketBackend) {
    $websocketBackend = $websocketBackend;
    $websocketBackend.mock();
    $websocketBackend.expectConnect('ws://localhost:1245/api');
    $websocketBackend.expectSend({data: JSON.stringify({test: true})});

    }));

    beforeEach(inject(function ($injector) {
    // The $controller service is used to create instances of controllers
    var $service = $injector.get('$service');
    createController = function () {
    return $service('mzksWebsocket');
    };
    }));

    it(’test1', function () {
    var mzksWebsocket = createController();
    //some test
    });

    ->failed to instantiate module ngWebSocketMock due to:
    Error: [$injector:nomod] Module 'ngWebSocketMock' is not available! You either misspelled the module name or forgot to load it. If registering a module ensu
    MILLER/F
    @millerf
    I fixed it.
    Benoit LeBlanc
    @beleblanc
    Hi there, Is there a quick way to find out if your socket is connected?
    nevermind, looked in source for readyStates :smile:
    Benoit LeBlanc
    @beleblanc
    Is this library still bein maintained though?
    Diego Benjamín Aguilar Aguilar
    @diegoaguilar
    @beleblanc I guess AngularClass/angular-websocket@88b6e88
    Benoit LeBlanc
    @beleblanc
    Will there be a new npm package soon with the latest merge as it resolves an issue I was having with webpack
    roelleor
    @roelleor
    Hi there, does anybody know about an angular2 version of websocket?
    MILLER/F
    @millerf
    It should be compatible, shouldn’t it?
    Antonio Troina
    @thoeni
    Hi guys, a quick question: I'm missing what the autoApply function should do. After around 60 seconds I see in my console.log this message: "angular.js:26309 Uncaught ReferenceError: autoApply is not defined" and my front-end stops receiving messages from the websocket server... any idea?
    nthibert
    @nthibert
    Hey all, I'm looking to bring this module into my project. My project is using requirejs. Anytime I require the module, it tries to require "ws" and fails which fails the whole page. I looked at the src and seems its trying to require in module, exports, angular and ws. Has anyone got around this issue?
    Harish Gadiya
    @harishgadiya
    how we can use angular websocket with typesscript anguarljs2 with unit testing
    Hamed Nourhani
    @hamednourhani
    hi must i use socket.io alongside angular to connect server socket or there is a builltin functionality with ng?
    Pulkit Agarwal
    @pulkit21
    This message was deleted
    This message was deleted
    Bart Peperkamp
    @bartpeperkamp
    Hi there, I managed to reconnect the socket session (in case of a server restart/error). The connection is 'open', however, i cannot get messages. Does anybody know what to do?
    Muhammad Aref
    @LeoAref
    I spent around 4 hours to figure out how to write a unit test, and I couldn't