Conversation
|
@artemyarulin If you're still interested in working on this, I refactored my code to allow for the two backends (see the If you don't have time, that's totally fine obviously, but I wanted to let you know. |
|
Thanks, really nice, I keep eye on everything related to PSCi. Unfortunately I don't have time to work on it now, but I'll try to play with it and report if anything interesting pop up. |
|
Alright, that's much cooler than my demo. 😄 I'm glad it worked for you, thank you for testing it out. |
|
That's so cool! |
psci/Main.hs
Outdated
| , " return buffer.join('\\n');" | ||
| , "};" | ||
| , "window.onload = function() {" | ||
| , " var socket = new WebSocket('ws://0.0.0.0:9160');" |
There was a problem hiding this comment.
Must remember to fix this port.
|
Can we put JS/HTML file into separate file? Now editing it is quiet difficult. And would be cool to have auto-reconnect logic |
|
Yes, I think that's a good idea, although the plan was that you wouldn't need to edit the JS/HTML, and would instead edit some foreign module in your project. |
|
I should be able to finish this off tomorrow, but it's pretty much ready for review now. |
|
I'm happy to test, just ping me when it's needed. Curious though - why limit client to only one connection? Only for simplicity of the first version? |
|
I thought about allowing multiple connections, but the issue is that I need the browser to return its result for printing, and with multiple connected browsers, that might get confusing. We can look into it later though, it might be interesting for testing out things like webworkers. |
|
Ok, this is ready for review now. I've tested it quite a bit, and it works quite nicely, but any additional testing is definitely appreciated. @artemyarulin I added support for multiple clients too, although I only show the result from the first browser to respond. |
|
Oh, wow, awesome! I'll test it during today/tomorrow |
|
Could someone please review the code here, so that we can try to release it in 0.9.2? |
|
Clearing the Travis cache seems to have fixed the issue, but we might need to keep a separate cache (or periodically clear the existing one) on MacOS. |
|
I'm probably not going to have any time to review until later in the week, sorry. |
|
Ok, no worries, thanks. |
|
I'm not qualified enough to check the code, but from the actual functionality - everything works just fine. |
psci/Main.hs
Outdated
| length js `seq` return (mid, js) | ||
| Bundle.bundle input [] Nothing "PSCI" | ||
|
|
||
| -- TODO: use JMacro here? |
There was a problem hiding this comment.
I haven't used JMacro, so I can't speak to its applicability here, but I have used file-embed successfully for this sort of thing before.
|
Looks good! 👍 I just watched the video, this looks really exciting! |
|
@hdgarrood Thanks for the review, I'll polish this up some time this weekend. |
|
@hdgarrood How's this? |
|
Code looks good to me! Would be nice if we could figure out how to test this. |
|
Looks good. Just checking: are these new files going to be included in source distributions? |
|
@hdgarrood I put them under |
|
Yeah, cool, thats what I was imagining. I guess I missed that change in the cabal file the first time I looked. |
|
So shall I merge this then? Maybe we can make a 0.9.2 release soon, with this, @kritzcreek's psc-ide changes, and hopefully fixes for some of the minor issues in the 0.9.2 milestone? |
|
I think what we have makes for a pretty nice |
* Initial work on evaluating PSCi expressions in the browser using websockets * Use Warp, add shutdown handler * Bundle all JS resources on startup * Refactoring before supporting multiple backends * Tidy up JavaScript component. Return output/exception stack to PSCi. * Refactor to allow different backends * Remove comments * Add port option, fork ping thread * Only allow one client * Support multiple clients, handle reloads * extra-deps * stack.yaml * Implement suggestions: use file-embed, save console.log, use case * Add static files to bundle

This is very rough right now, but it works, and here's a demo.
This assumes some client JavaScript code which understands the websocket protocol being used. I put this together as a quick experiment based on the Try PureScript code.
--browsercommand line option:reloadFixes #2142.
cc @artemyarulin I see you've been working on this too. We should combine efforts, if you're interested?