jeffbcross / aim

82 stars 27 forks source link

Create a socket-based service to manage conversations #3

Closed jeffbcross closed 8 years ago

jeffbcross commented 8 years ago

Needs to manage connection with a websocket that will send and receive messages with the app. Needs to implement multiplexing logic to use a single websocket subscription for many conversations. Needs to handle reconnecting gracefully. Needs to support creation of new conversations.

Potential API:

enum ConnectionStates {CONNECTED, CONNECTING, WAITING_TO_RETRY}
interface Message {
  id?:string;
  channel: string;
  otherUser: string;
}

interface Channel {
  id?:string;
  // List of github usernames
  partcipants: List<string>;
}

interface User {
  username: string;
}

interface SelfUser extends User {
  token: string;
}

class ChatService {
  messages: Observable<Message>;
  connectionState: Observable<ConnectionStates>;
  activeChannels: Observable<List<Channel>>;
  createChannel(user:User):void {}
  registerUser(user:SelfUser):void {}
}