lvivski / start

Sinatra inspired web development framework for Dart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor WebSocket Message parsing into an external pub

MarkBennett opened this issue · comments

Clients can't include the Start library as it uses parts of the Dart stdlib not accessable in the web browser. That said, it would be good if there was some common code which allowed WebSocket messages to be consistently serialized and de-serialized between the client and server.

I'm going to work on building this external pub, then including it in the list of Start's dependencies but obviously wanted to hear your thoughts before I started work.

I think there's no need for a separate package, you can create one additional lib, like in here http://github.com/lvivski/speaker/tree/master/lib, for client side

Does that work together with the WebSocket implementation in Start, or do you see apps running a start server for handling HTTP requests, and a speaker server for WebSpockets? If so, maybe I'll switch my app to use speaker for the websockets. If their meant to be compatible however, then a shared dependency would still probably make sense.

No, we shouldn't integrate them. I just suggest to create some start/lib/socket.dart, use it in server-side start libs, and also it will be available for client-side inclusion. So user will only have to depend on one lib (start), and to include package:start/start.dart in server-side scripts and some package:start/socket.dart in client-side scripts

Ah, gotcha. I'm still pretty new to Dart and forgot that I don't actually do anything with the pubspec.yaml on the client.

I'll close this issue.