websocket
This commit is contained in:
parent
72d6f53020
commit
94031cc356
16 changed files with 26 additions and 45 deletions
|
@ -1,6 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="C:/Program Files (x86)/MySQL/Connector J 8.0/mysql-connector-java-8.0.22.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Program Files/tyrus-standalone-client-1.9.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Program Files/javax.websocket-client-api-1.1.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
3
Application/Clavardage/bin/.gitignore
vendored
3
Application/Clavardage/bin/.gitignore
vendored
|
@ -1,3 +1,2 @@
|
|||
/websocket/
|
||||
/controller/
|
||||
/model/
|
||||
/view/
|
||||
|
|
BIN
Application/Clavardage/bin/model/Chat.class
Normal file
BIN
Application/Clavardage/bin/model/Chat.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/model/LocalUser.class
Normal file
BIN
Application/Clavardage/bin/model/LocalUser.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/model/Message.class
Normal file
BIN
Application/Clavardage/bin/model/Message.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/model/Msg_Text.class
Normal file
BIN
Application/Clavardage/bin/model/Msg_Text.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/model/RemoteUser.class
Normal file
BIN
Application/Clavardage/bin/model/RemoteUser.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/model/User.class
Normal file
BIN
Application/Clavardage/bin/model/User.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/view/Interface$1.class
Normal file
BIN
Application/Clavardage/bin/view/Interface$1.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/view/Interface$2.class
Normal file
BIN
Application/Clavardage/bin/view/Interface$2.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/view/Interface$3.class
Normal file
BIN
Application/Clavardage/bin/view/Interface$3.class
Normal file
Binary file not shown.
BIN
Application/Clavardage/bin/view/Interface.class
Normal file
BIN
Application/Clavardage/bin/view/Interface.class
Normal file
Binary file not shown.
|
@ -8,6 +8,7 @@ import java.net.DatagramPacket;
|
|||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
|
@ -17,6 +18,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.websocket.DeploymentException;
|
||||
|
||||
import model.Chat;
|
||||
import model.LocalUser;
|
||||
|
@ -24,6 +26,7 @@ import model.Message;
|
|||
import model.Msg_Text;
|
||||
import model.RemoteUser;
|
||||
import view.Interface;
|
||||
import websocket.Appel;
|
||||
|
||||
public class Controller {
|
||||
|
||||
|
@ -508,6 +511,8 @@ public class Controller {
|
|||
Controller ctr = new Controller(31014,portUDPlistening_local,31024,histoire);
|
||||
lstCtr.add(ctr);
|
||||
|
||||
Appel app=new Appel();
|
||||
app.test();
|
||||
|
||||
/** Loop **/
|
||||
Boolean running = isRunning(lstCtr);
|
||||
|
|
|
@ -16,13 +16,18 @@ public class Appel {
|
|||
private Client client;
|
||||
|
||||
public void test() {
|
||||
this.container= ContainerProvider.getWebSocketContainer();
|
||||
this.client=new Client();
|
||||
|
||||
Session session=null;
|
||||
try {
|
||||
Session session=this.container.connectToServer(this.client, new URI ("ws://localhost:8080/Clavardage/hello"));
|
||||
session=this.container.connectToServer(this.client, new URI ("ws://localhost:8082/WebSocket2/hello"));
|
||||
} catch (DeploymentException | IOException | URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("pb avec le connect");
|
||||
}
|
||||
try {
|
||||
this.client.onOpen(session, null);
|
||||
this.client.sendMessage("hello from client");
|
||||
} catch (IOException e) {
|
||||
System.out.println("pb avec le sendMessage");
|
||||
|
@ -30,10 +35,5 @@ public class Appel {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onInit(){
|
||||
this.container= ContainerProvider.getWebSocketContainer();
|
||||
this.client=new Client();
|
||||
}
|
||||
}
|
||||
|
|
5
Application/Clavardage/src/websocket/Centralized.java
Normal file
5
Application/Clavardage/src/websocket/Centralized.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package websocket;
|
||||
|
||||
public class Centralized {
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package websocket;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import javax.websocket.ContainerProvider;
|
||||
import javax.websocket.DeploymentException;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
|
||||
import org.junit.Before;
|
||||
|
||||
|
||||
class Test {
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void test() throws IOException, DeploymentException, URISyntaxException {
|
||||
Session session=this.container.connectToServer(this.client, new URI ("ws://localhost:8080/Clavardage/hello"));
|
||||
this.client.sendMessage("hello from client");
|
||||
}
|
||||
|
||||
|
||||
private WebSocketContainer container;
|
||||
private Client client;
|
||||
@Before
|
||||
public void onInit(){
|
||||
this.container= ContainerProvider.getWebSocketContainer();
|
||||
this.client=new Client();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue