-
Notifications
You must be signed in to change notification settings - Fork 1
Ports #1
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
base: develop
Are you sure you want to change the base?
Conversation
I tested the JavaScript code in the Chrome debugging console. Next: encoder/decoder for the messages sent back and forth.
|
I hope this helps. Would you like me to write some Elm code to talk to it? That will probably be in the form of a |
|
@billstclair this is a great contribution. we need to support votes for a question choice. I'm thinking the data shape might be something like: type alias Model =
{ path : String
, questions : SelectList Question
}
type alias Question =
{ text : String
, choices : Array (String, VoteCount)
, correct : List ChoiceIndex
}
type alias VoteCount = Int
type alias ChoiceIndex = IntAlthough it's not perfect — you could have a ChoiceIndex that is out of range (invalid state).
|
|
You can get rid of the invalid state fairly easily: type alias Question =
{ text : String
, choices : Array (String, IsCorrect, VoteCount)
}
type alias IsCorrect = BoolBut my question was about the low-level interface to the WebSocket ports. That will support strings out and strings in. It will need another layer that supports whatever protocol is required by FireBase. Maybe that whole thing belongs in a separate file. |
|
Well, that's what I get for not looking at Firebase docs before writing WebSocket code. We're going to want to program against the Firebase API, and it will do the WebSocket stuff for us. Duh. Looking at that now. Please don't merge this branch. It's going to change a lot. |
|
Allow me to think out loud here. type alias Model =
{ questionsGroupSlug : String
, questions : SelectList Question
}
type alias Question =
{ text : String
, choices : Array Choice
}
type alias Choice =
{ text: String
, correct: Bool
, votes: Int
}So a browser would connect to They can then select a choice, and the application would go into a read only state (unless they refresh? not sure how to prevent duplicate voting) and they would see the screen update with everyones votes coming in. When a response comes in (a choice index), we look at the currently selected question in the SelectList and increment the votes in the Choice at that array index. When the presenter choses to advance the slide (from /admin, let's say) a message goes out to all connected clients and they advance their slide. That's what I've got so far. I'm going to start on this data model and UI tonight. |
|
I had to drive an hour from home to give my daughter a ride to her community college class. I'm in the library there for another 2.5 hours, then 1.5 hour drive back home. I'm going to do my paid work, so nothing on this until the afternoon, or early evening. I still don't know how you plan to use Firebase to provide storage for this. Maybe you don't either, except that it should be possible. |
Yep |
No description provided.