Skip to content

What is the preference of streams? #3944

Answered by pepone
kamyar1979 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Kamyar,

That sounds pretty cool!

If you let bikes (devices) send a regular request without streaming parameters each time they update their location, there's nothing inherently wrong with that approach.

The thermostat example employs a "stream parameter" for the readings because it has less overhead—you're not creating a separate request for each reading.

Streaming Approach:

struct GpsLocation {
    latitude: float64
    longitude: float64
}

interface BikeStation {
    UpdateBikeLocation(bikeId: int64, stream location: GpsLocation);
}

With this approach, the bike device sends a request with its ID and then continuously streams its GPS coordinates to the bike station.

Non-Streaming App…

Replies: 0 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by ReeceHumphreys
Comment options

You must be logged in to vote
1 reply
@pepone
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants