saltyrtc / saltyrtc-client-js Goto Github PK
View Code? Open in Web Editor NEWSaltyRTC JavaScript implementation.
License: MIT License
SaltyRTC JavaScript implementation.
License: MIT License
We should be able to test the code without any existing webclient.
@lgrahl, do you know what the easiest way would be? Can we test client/server on a single machine?
Integration with Travis would also be welcome.
What are minimal required browsers?
Right now all classes are exposed as AngularJS services. That's not relevant here and can be removed.
This also means that the logging system needs to be replaced.
Some messages in the handshake can be sent in parallel, instead of waiting for the other peer.
The sender byte should always be validated.
Once the handshake is done, messages with a different sender byte should be dropped.
@lgrahl it's correct that they should be silently dropped, right?
Should we compile-in a copy of the msgpack and nacl libraries?
Pro:
Con:
@lgrahl what do you think?
Alternatively we could also provide two distributions, a fat and a light one.
I guess the readme is simply outdated? It lacks setting a task. Or is there a default task?
https://github.com/saltyrtc/saltyrtc-meta/blob/master/Protocol.md#client-to-client-messages
Compared to client-to-server messages, protocol errors for client-to-client message MUST be handled differently. In case that any check fails, the procedure below MUST be followed unless otherwise stated:
The same issue as saltyrtc/saltyrtc-client-java#42 probably applies here too.
It might be possible to create a cleaner solution thanks to the single threaded nature of JS.
As discussed in saltyrtc/saltyrtc-meta#34
interface Event {
type: string,
data: any,
}
type EventHandler = (ev: Event) => boolean | void;
// Register an event handler
on(event: string | string[], handler: EventHandler): void;
// Run an event handler only once
once(event: string | string[], handler: EventHandler): void;
// Cancel an event handler
off(event: string | string[], handler?: EventHandler): void;
connected
, connection-error
, connection-closed
and data
data
event can be specialized, e.g. data:offer
will only match events where offer
matches the dataType
false
, the corresponding listener will be removedoff(event)
call, all handlers will be removedExamples:
// Classic event handler
salty.on('connected', (event) => console.log('SaltyRTC is connected'));
// One-time event handler
salty.once('data', (event) => console.log('The first message arrived.'));
// Data event handler that can remove itself
salty.on('data', (event) => {
if (event.data.dataType === 'panic') {
console.error('everybody panic');
return false;
}
});
// Specialized event handler(s)
salty.on(['data:offer', 'data:answer'], (event) => {
console.log('A', event.type, 'event is being handled');
let dataMessage = event.data;
console.info('Message', dataMessage.dataType, 'with value', dataMessage.data);
});
// Deregistration
function acceptPranswer(event) {
console.log('pranswer arrived');
}
salty.on('data:pranswer', acceptPranswer);
salty.once('data:answer', (event) => {
console.log('final answer arrived');
// Don't accept pranswers anymore
salty.off('data:pranswer', acceptPranswer);
});
The terminology used is not consistent.
Right now it's possible that the connection-closed event is thrown twice when closing the connection directly (once in resetConnection and once in onClose).
Maybe there's a way to detect whether the closing was done by us or by the server?
On forced connection reset (e.g. when a protocol error occurs), should the task connection also be closed if it's already open?
The WebRTC task spec should now be stable and is ready to be implemented.
Create subclasses for Initiator and Responder.
Apparently it currently stays open.
Steps to reproduce:
Babel will have solved some of the issues with older browsers.
See changes from saltyrtc/saltyrtc-meta#47
https://github.com/saltyrtc/saltyrtc-meta/blob/master/Protocol.md#close-message
It should call a sendClose method on the signaling class.
All TODOs left should have an issue number in the comment.
Typescript should be able to generate .d.ts files with the public API.
Chrome doesn't support larger messages than 16KiB. https://webrtc.org/web-apis/chrome/
As a good server there is e.g. https://github.com/andyet/signalmaster.
Is it possible to use your own servers here?
Having to set the public key as well is confusing as it can be retrieved from the private key.
See 9d5abca
There is a new field called subprotocols, see here for details.
For KeyStore
and withTrustedKeerKey
.
Some functionality like this.
...could be moved into the Peer
class. Then polymorphism could replace if-else statements.
They fail on Travis.
See client-auth message
Some projects might want to know the internal signaling state.
It might be interesting to provide Angular glue code (i.e. services) for this library (in a separate library).
...so that when logging a send-error message, we actually know which message was lost.
We could support keeping the ws connection open after a send-error message to wait for a reconnect.
The 'drop-responder' message has been changed. An initiator MAY now add a reason field to a 'drop-responder' message the server SHALL close the connection to the corresponding responder with. That field contains a close code described here
When to use the reason field has been described here.
The 'close' message has been added.
All WebRTC-related messages have been removed from the spec and will be moved into a separate task soon. I'll use a new branch for that.
Go through spec and make sure that everything is implemented correctly.
It has been dropped from the spec.
Further information can be found here
Discussion in saltyrtc/saltyrtc-meta#19 and saltyrtc/saltyrtc-meta#40
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.