Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with sierra component integration #6

Open
cjsauer opened this issue Dec 18, 2017 · 3 comments · May be fixed by #9
Open

Issues with sierra component integration #6

cjsauer opened this issue Dec 18, 2017 · 3 comments · May be fixed by #9

Comments

@cjsauer
Copy link

cjsauer commented Dec 18, 2017

Hello,

First, thanks for this library. It's an awesome accomplishment.

I'm having some issues with wrapping tubes into a Sierra component (https://github.com/stuartsierra/component)

Mainly, from reading the code, it doesn't seem like support for (tubes/create! t), followed by (tubes/destroy! t), followed by another call to (tubes/create! t) is a supported operation. I'm noticing that the tube is still marked as :destroyed true even after I re-create it.

What is your suggestion for stopping and then starting a tube? Thanks!

@drapanjanas
Copy link
Owner

Hi, thanks for the report!
I think you should be able to do that what you described. I do not use it like that in my app so I did not notice this problem before.
Now I think problem might be somewhere here: https://github.com/drapanjanas/pneumatic-tubes/blob/master/src/cljs/pneumatic_tubes/core.cljs#L66
But I do not remember why I mark instances as destroyed and do not just remove them. I will give some thoughts about it and will fix this.

@cjsauer
Copy link
Author

cjsauer commented Dec 18, 2017

@drapanjanas could potentially be that the websocket's on-close event is asynchronous? It looks like there might be some cleanup code that runs in there, but I'm not sure.

Thanks for taking a look.

@drapanjanas
Copy link
Owner

drapanjanas commented Dec 19, 2017

@cjsauer yes I think this happens because of async onclose and onopen.
Also because of the design issue. One way to fix this is to make tubes/create always return a new instance which can be used and destroyed independently.
New code would look smth like this:

(def tube (tubes/create "ws://localhost:9090/ws" on-recv))
(dispatch tube [:my-event])
(tubes/destroy tube))

Not sure about old code, but might still be working.

@drapanjanas drapanjanas linked a pull request Dec 25, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants