Ajay Chandran

Results 24 comments of Ajay Chandran

@lolgab Yes, but the Future is evaluated [eagerly](https://svejcar.dev/posts/2019/11/14/troubles-with-future/). In contrast, `AjaxEventStream` submits the request in `onStart`, thus delaying effects (network request) until observers are registered.

Thanks for your suggestions. I will incorporate them and submit a PR. Regarding websockets, - I would like to have single implementation that is bi-directional (and can be used for...

The usecase I had in mind is to restart a websocket stream when the underlying connection stops, for instance, when the user loses connectivity. When connectivity is resumed, it may...

How about `restartOn(control: EventStream[Any])`? This is flexible enough to accommodate a wide variety of usecases (restart max `n` times, restart after `d` duration, restart max `n` times + after `d`...

The initial draft for the websocket implementation is available in this [branch.](https://github.com/raquo/Airstream/tree/wip-websockets). - Uni-directional and bi-directional usecases are supported with the same class. Need some input on the following: -...

The above issues have been resolved for now. > - The type of dom.MessageEvent.data is Any. This would require a cast at call site, event.data.asInstanceOf[String]. Is this fine? Added `project`...

How about something similar to [this pattern](https://github.com/raquo/Airstream/blob/8883fdba9e6508342b71b2990e36c13b662b406a/src/main/scala/com/raquo/airstream/web/WebSocketEventStream.scala#L126)? ```scala object AjaxEventStream { def apply( url: String, data: dom.ext.Ajax.InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean...

> What would be in those ??? then? I assume it's new AjaxEventStream(...) with all the same params again for each method. Correct. I prefer the usage pattern it promotes....

> Side note, final would be redundant in this case even on Scala 2.12 I think. Thanks. I had extended this [best-practice](https://nrinaudo.github.io/scala-best-practices/adts/final_case_objects.html) to non-case objects and followed it blindly. Time...

I have `Signal` containing a list of non-unique elements that each map to an image. Using `observable.map(_.zipWithIndex).split(_._2)(...)` works but requires creating an intermediate list.