Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Wasm Sockets
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Wasm Sockets
Commits
0624beca
Unverified
Commit
0624beca
authored
4 years ago
by
scratchyone
Browse files
Options
Downloads
Patches
Plain Diff
Rename BlockingClient to PollingClient
parent
92d1cc78
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/index.html
+1
-1
1 addition, 1 deletion
examples/index.html
examples/polling.rs
+1
-1
1 addition, 1 deletion
examples/polling.rs
src/lib.rs
+2
-2
2 additions, 2 deletions
src/lib.rs
with
4 additions
and
4 deletions
examples/index.html
+
1
−
1
View file @
0624beca
...
...
@@ -22,7 +22,7 @@
</style>
</head>
<script
type=
"module"
>
import
init
from
'
../target/
block
ing.js
'
;
import
init
from
'
../target/
poll
ing.js
'
;
init
();
</script>
</html>
This diff is collapsed.
Click to expand it.
examples/
block
ing.rs
→
examples/
poll
ing.rs
+
1
−
1
View file @
0624beca
...
...
@@ -13,7 +13,7 @@ fn main() -> Result<(), JsValue> {
info!
(
"Creating connection"
);
// Client is wrapped in an Rc<RefCell<>> so it can be used within setInterval
let
client
=
Rc
::
new
(
RefCell
::
new
(
wasm_sockets
::
Block
ingClient
::
new
(
let
client
=
Rc
::
new
(
RefCell
::
new
(
wasm_sockets
::
Poll
ingClient
::
new
(
"wss://echo.websocket.org"
,
)
?
));
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
2
−
2
View file @
0624beca
...
...
@@ -89,14 +89,14 @@ pub enum Message {
Text
(
String
),
Binary
(
Vec
<
u8
>
),
}
pub
struct
Block
ingClient
{
pub
struct
Poll
ingClient
{
pub
url
:
String
,
pub
event_client
:
EventClient
,
pub
status
:
Rc
<
RefCell
<
ConnectionStatus
>>
,
pub
data
:
Rc
<
RefCell
<
Vec
<
Message
>>>
,
}
// TODO: Replace unwraps and JsValue with custom error type
impl
Block
ingClient
{
impl
Poll
ingClient
{
pub
fn
new
(
url
:
&
str
)
->
Result
<
Self
,
JsValue
>
{
// Create connection
let
mut
client
=
EventClient
::
new
(
url
)
?
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment