import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;

import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import io.socket.engineio.client.Transport;
import io.socket.engineio.client.transports.Polling;
import io.socket.engineio.client.transports.WebSocket;
import javafx.application.Application;
import javafx.stage.Stage;
import okhttp3.OkHttpClient;

public class App extends Application {
	static Client socket;
	static String username;
	static ArrayList<String> activeUsers = new ArrayList<String>();
	static ArrayList<String> messages = new ArrayList<String>();

	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(final Stage primaryStage) throws Exception {
		socket = new Client(primaryStage);
		primaryStage.setTitle("Messaging app");
		primaryStage.setResizable(false);
		primaryStage.setScene(LoginPage.makeLoginPage(primaryStage, socket));
		primaryStage.show();
    }
	
	@Override
	public void stop(){
		System.out.println("disconnecting");
	    socket.disconnect();
	}
}
