Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
aut0m4t0n
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Liese
aut0m4t0n
Commits
519deeda
Commit
519deeda
authored
Feb 15, 2020
by
SR-Lut3t1um
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start work on websocket
parent
ca8dbc11
Pipeline
#89215
passed with stages
in 3 minutes and 5 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
139 additions
and
147 deletions
+139
-147
README.md
README.md
+10
-1
build.gradle
build.gradle
+1
-0
src/main/java/org/un1qu3/endpoints/AutomatonSocket.java
src/main/java/org/un1qu3/endpoints/AutomatonSocket.java
+64
-0
src/main/resources/META-INF/resources/index.html
src/main/resources/META-INF/resources/index.html
+9
-145
src/main/resources/META-INF/resources/main.css
src/main/resources/META-INF/resources/main.css
+40
-0
src/main/resources/META-INF/resources/main.js
src/main/resources/META-INF/resources/main.js
+9
-0
src/main/resources/application.properties
src/main/resources/application.properties
+6
-1
No files found.
README.md
View file @
519deeda
...
...
@@ -32,4 +32,13 @@ Or you can use Docker to build the native executable using: `./gradlew buildNati
You can then execute your binary:
`./build/machine-1.0.0-SNAPSHOT-runner`
If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling#building-a-native-executable .
\ No newline at end of file
If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling#building-a-native-executable .
## Websocket protocol:
automaton/id/states (operation) [info]
eg:
automaton/id/states add q1
automaton/id/name set "Cool Name"
\ No newline at end of file
build.gradle
View file @
519deeda
...
...
@@ -16,6 +16,7 @@ dependencies {
implementation
enforcedPlatform
(
"${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"
)
implementation
'io.quarkus:quarkus-resteasy'
implementation
'io.quarkus:quarkus-resteasy-qute'
implementation
'io.quarkus:quarkus-jdbc-postgresql'
testImplementation
'io.quarkus:quarkus-junit5'
testImplementation
'io.rest-assured:rest-assured'
...
...
src/main/java/org/un1qu3/endpoints/AutomatonSocket.java
0 → 100644
View file @
519deeda
package
org.un1qu3.endpoints
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
javax.enterprise.context.ApplicationScoped
;
import
javax.websocket.OnClose
;
import
javax.websocket.OnError
;
import
javax.websocket.OnMessage
;
import
javax.websocket.OnOpen
;
import
javax.websocket.Session
;
import
javax.websocket.server.ServerEndpoint
;
@ServerEndpoint
(
"/websocket"
)
@ApplicationScoped
public
class
AutomatonSocket
{
Map
<
String
,
Session
>
sessions
=
new
ConcurrentHashMap
<>();
@OnOpen
public
void
onOpen
(
Session
session
)
{
String
username
=
"Hans"
;
sessions
.
put
(
username
,
session
);
broadcast
(
"User "
+
username
+
" joined"
);
}
@OnClose
public
void
onClose
(
Session
session
)
{
String
username
=
"Hans"
;
sessions
.
remove
(
username
);
broadcast
(
"User "
+
username
+
" left"
);
}
@OnError
public
void
onError
(
Session
session
,
Throwable
throwable
)
{
String
username
=
"Hans"
;
sessions
.
remove
(
username
);
broadcast
(
"User "
+
username
+
" left on error: "
+
throwable
);
}
@OnMessage
public
void
onMessage
(
String
message
)
{
String
username
=
"Hans"
;
String
[]
msg
=
message
.
split
(
" "
);
if
(
msg
[
0
].
startsWith
(
"automaton"
))
{
if
(
msg
[
1
].
contains
(
"add"
))
{}
}
}
private
void
broadcast
(
String
message
)
{
sessions
.
values
()
.
forEach
(
s
->
{
s
.
getAsyncRemote
()
.
sendObject
(
message
,
result
->
{
if
(
result
.
getException
()
!=
null
)
{
System
.
out
.
println
(
"Unable to send message: "
+
result
.
getException
());
}
});
});
}
}
src/main/resources/META-INF/resources/index.html
View file @
519deeda
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
machine - 1.0.0-SNAPSHOT
</title>
<style>
h1
,
h2
,
h3
,
h4
,
h5
,
h6
{
margin-bottom
:
0.5rem
;
font-weight
:
400
;
line-height
:
1.5
;
}
h1
{
font-size
:
2.5rem
;
}
h2
{
font-size
:
2rem
}
h3
{
font-size
:
1.75rem
}
h4
{
font-size
:
1.5rem
}
h5
{
font-size
:
1.25rem
}
h6
{
font-size
:
1rem
}
.lead
{
font-weight
:
300
;
font-size
:
2rem
;
}
.banner
{
font-size
:
2.7rem
;
margin
:
0
;
padding
:
2rem
1rem
;
background-color
:
#00A1E2
;
color
:
white
;
}
body
{
margin
:
0
;
font-family
:
-apple-system
,
system-ui
,
"Segoe UI"
,
Roboto
,
"Helvetica Neue"
,
Arial
,
sans-serif
,
"Apple Color Emoji"
,
"Segoe UI Emoji"
,
"Segoe UI Symbol"
,
"Noto Color Emoji"
;
}
code
{
font-family
:
SFMono-Regular
,
Menlo
,
Monaco
,
Consolas
,
"Liberation Mono"
,
"Courier New"
,
monospace
;
font-size
:
87.5%
;
color
:
#e83e8c
;
word-break
:
break-word
;
}
.left-column
{
padding
:
.75rem
;
max-width
:
75%
;
min-width
:
55%
;
}
.right-column
{
padding
:
.75rem
;
max-width
:
25%
;
}
.container
{
display
:
flex
;
width
:
100%
;
}
li
{
margin
:
0.75rem
;
}
.right-section
{
margin-left
:
1rem
;
padding-left
:
0.5rem
;
}
.right-section
h3
{
padding-top
:
0
;
font-weight
:
200
;
}
.right-section
ul
{
border-left
:
0.3rem
solid
#00A1E2
;
list-style-type
:
none
;
padding-left
:
0
;
}
</style>
<meta
charset=
"UTF-8"
>
<title>
Aut0m4t0n // Alpha
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"main.css"
>
</head>
<body>
<div
class=
"banner lead"
>
Your new Cloud-Native application is ready!
</div>
<div
class=
"container"
>
<div
class=
"left-column"
>
<p
class=
"lead"
>
Congratulations, you have created a new Quarkus application.
</p>
<h2>
Why do you see this?
</h2>
<p>
This page is served by Quarkus. The source is in
<code>
src/main/resources/META-INF/resources/index.html
</code>
.
</p>
<h2>
What can I do from here?
</h2>
<p>
If not already done, run the application in
<em>
dev mode
</em>
using:
<code>
mvn compile quarkus:dev
</code>
.
</p>
<ul>
<li>
Add REST resources, Servlets, functions and other services in
<code>
src/main/java
</code>
.
</li>
<li>
Your static assets are located in
<code>
src/main/resources/META-INF/resources
</code>
.
</li>
<li>
Configure your application in
<code>
src/main/resources/application.properties
</code>
.
</li>
</ul>
<h2>
How do I get rid of this page?
</h2>
<p>
Just delete the
<code>
src/main/resources/META-INF/resources/index.html
</code>
file.
</p>
</div>
<div
class=
"right-column"
>
<div
class=
"right-section"
>
<h3>
Application
</h3>
<ul>
<li>
GroupId: org.un1qu3
</li>
<li>
ArtifactId: machine
</li>
<li>
Version: 1.0.0-SNAPSHOT
</li>
<li>
Quarkus Version: 1.2.0.Final
</li>
</ul>
</div>
<div
class=
"right-section"
>
<h3>
Next steps
</h3>
<ul>
<li><a
href=
"https://quarkus.io/guides/maven-tooling.html"
target=
"_blank"
>
Setup your IDE
</a></li>
<li><a
href=
"https://quarkus.io/guides/getting-started.html"
target=
"_blank"
>
Getting started
</a></li>
<li><a
href=
"https://quarkus.io"
target=
"_blank"
>
Quarkus Web Site
</a></li>
</ul>
</div>
</div>
</div>
<ul>
<li><a>
Aut0m4t0n
</a></li>
<li><a>
NEW
</a></li>
</ul>
<canvas
id=
"canvas"
width=
"1"
height=
"1"
></canvas>
<script
src=
"main.js"
></script>
</body>
</html>
\ No newline at end of file
src/main/resources/META-INF/resources/main.css
0 → 100644
View file @
519deeda
*
{
margin
:
0
;
padding
:
0
;
}
@media
(
prefers-color-scheme
:
dark
)
{
:root
{
--main-bg-color
:
black
;
--main-ac-color
:
#212121
;
--main-color
:
whitesmoke
;
--toolbar-height
:
2vh
;
}
}
ul
{
list-style-type
:
none
;
overflow
:
hidden
;
background-color
:
var
(
--main-bg-color
);
}
li
{
float
:
left
;
}
li
a
{
display
:
block
;
color
:
var
(
--main-color
);
text-align
:
center
;
padding
:
var
(
--toolbar-height
);
text-decoration
:
none
;
}
li
a
:hover
{
background-color
:
var
(
--main-ac-color
);
}
canvas
{
width
:
100%
;
height
:
80%
;
}
\ No newline at end of file
src/main/resources/META-INF/resources/main.js
0 → 100644
View file @
519deeda
let
canvas
=
document
.
getElementsByTagName
(
'
canvas
'
)[
0
];
canvas
.
height
=
80
;
canvas
.
width
=
canvas
.
style
.
width
;
let
webSocket
=
new
WebSocket
(
'
ws://
'
+
window
.
location
.
host
+
"
/websocket
"
);
webSocket
.
onopen
=
function
(
event
)
{
console
.
log
(
"
Socket connected
"
)
};
\ No newline at end of file
src/main/resources/application.properties
View file @
519deeda
# Configuration file
#
key
=
value
\ No newline at end of file
quarkus.datasource.url
=
jdbc:postgresql://localhost:5432/hibernate_db
quarkus.datasource.driver
=
org.postgresql.Driver
quarkus.datasource.username
=
root
quarkus.datasource.password
=
test123
# drop and create the database at startup (use `update` to only update the schema)
quarkus.hibernate-orm.database.generation
=
update
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment