2025-09-19 19:48:50 +02:00
|
|
|
# Open Autonomous Connection Protocol
|
|
|
|
|
|
2025-12-11 10:40:37 +01:00
|
|
|
> [!IMPORTANT]
|
|
|
|
|
> This is the classic version!
|
|
|
|
|
> Classic version is not longer maintained or supported please switch the Branch to master
|
|
|
|
|
> The new Protocol has a Backwards compatibility and is supporting the classic Version
|
|
|
|
|
|
2025-09-19 19:48:50 +02:00
|
|
|
This is the Protocol for our Open Autonomous Connection project.<br />
|
|
|
|
|
You can easily implement this Protocol via Maven.<br />
|
|
|
|
|
Feel free to join our Discord.
|
|
|
|
|
<br />
|
2025-12-11 10:40:37 +01:00
|
|
|
<br />
|
2025-09-19 19:48:50 +02:00
|
|
|
|
|
|
|
|
# Bugs/Problems
|
|
|
|
|
# In progress
|
2025-12-11 10:40:37 +01:00
|
|
|
- Cleanup Code
|
2025-09-19 19:48:50 +02:00
|
|
|
# TODO
|
2025-12-11 10:40:37 +01:00
|
|
|
- Subdomains
|
|
|
|
|
- Fragments
|
2025-12-08 10:44:15 +01:00
|
|
|
|
2025-12-11 10:40:37 +01:00
|
|
|
# Maven
|
2025-09-19 19:48:50 +02:00
|
|
|
### pom.xml
|
|
|
|
|
```
|
|
|
|
|
<dependency>
|
2025-12-11 10:40:37 +01:00
|
|
|
<groupId>me.openautonomousconnection</groupId>
|
2025-09-19 19:48:50 +02:00
|
|
|
<artifactId>protocol</artifactId>
|
2025-12-11 10:40:37 +01:00
|
|
|
<version>1.0.0-Classic</version>
|
|
|
|
|
<scope>compile</scope>
|
2025-09-19 19:48:50 +02:00
|
|
|
</dependency>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Repository:
|
|
|
|
|
```
|
2025-09-24 22:05:02 +02:00
|
|
|
<repository>
|
2025-09-29 17:46:30 +02:00
|
|
|
<id>oac</id>
|
2025-09-24 22:05:02 +02:00
|
|
|
<url>https://repo.open-autonomous-connection.org/api/packages/open-autonomous-connection/maven</url>
|
|
|
|
|
<snapshots>
|
|
|
|
|
<enabled>true</enabled>
|
|
|
|
|
</snapshots>
|
|
|
|
|
</repository>
|
2025-12-11 10:40:37 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# Examples
|
|
|
|
|
#### Note: These examples are very basic
|
|
|
|
|
### Server
|
|
|
|
|
|
|
|
|
|
```java
|
|
|
|
|
import me.finn.unlegitlibrary.network.system.server.ConnectionHandler;
|
|
|
|
|
import org.openautonomousconnection.protocol.ProtocolBridge;
|
|
|
|
|
import org.openautonomousconnection.protocol.ProtocolSettings;
|
|
|
|
|
import org.openautonomousconnection.protocol.ProtocolVersion;
|
|
|
|
|
import side.org.openautonomousconnection.protocol.ProtocolServer;
|
|
|
|
|
|
|
|
|
|
public class Server extends ProtocolServer {
|
|
|
|
|
|
|
|
|
|
public Server() throws IOException, InterruptedException {
|
|
|
|
|
super(10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
try {
|
|
|
|
|
ProtocolBridge protocolBridge = new ProtocolBridge(ProtocolVersion.PV_1_0_0, new ProtocolSettings(), new Server());
|
|
|
|
|
protocolBridge.getProtocolServer().setProtocolBridge(protocolBridge);
|
|
|
|
|
protocolBridge.getProtocolServer().startServer();
|
|
|
|
|
} catch (IOException | InterruptedException | InvocationTargetException | InstantiationException |
|
|
|
|
|
IllegalAccessException | NoSuchMethodException exception) {
|
|
|
|
|
exception.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Domain> getDomains() throws SQLException {
|
|
|
|
|
return List.of(); // Your method here to get all registered domains
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handleMessage(ConnectionHandler connectionHandler, String message) {
|
|
|
|
|
System.out.println("Received message: " + message + " from client: " + connectionHandler.getClientID());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
### Client
|
|
|
|
|
|
|
|
|
|
```java
|
|
|
|
|
import org.openautonomousconnection.protocol.ProtocolBridge;
|
|
|
|
|
import org.openautonomousconnection.protocol.ProtocolSettings;
|
|
|
|
|
import org.openautonomousconnection.protocol.ProtocolVersion;
|
|
|
|
|
import domain.org.openautonomousconnection.protocol.Domain;
|
|
|
|
|
import side.org.openautonomousconnection.protocol.ProtocolClient;
|
|
|
|
|
import utils.org.openautonomousconnection.protocol.SiteType;
|
|
|
|
|
|
|
|
|
|
public class Client extends ProtocolClient {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
try {
|
|
|
|
|
ProtocolBridge protocolBridge = new ProtocolBridge(ProtocolVersion.PV_1_0_0, new ProtocolSettings(), new Client());
|
|
|
|
|
protocolBridge.getProtocolClient().setProtocolBridge(protocolBridge);
|
|
|
|
|
protocolBridge.getProtocolServer().startClient();
|
|
|
|
|
} catch (IOException | InterruptedException | InvocationTargetException | InstantiationException |
|
|
|
|
|
IllegalAccessException | NoSuchMethodException exception) {
|
|
|
|
|
exception.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handleHTMLContent(SiteType siteType, Domain domain, String htmlContent) {
|
|
|
|
|
System.out.println("Website html content received. This site is " + siteType.name);
|
|
|
|
|
System.out.println(htmlContent); // Render content in a webview for example
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handleMessage(String message) {
|
|
|
|
|
System.out.println("Received message: " + message);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-08 10:44:15 +01:00
|
|
|
```
|