David Baker
0f38764709
No point throwing the exception if we return the original promise
2016-03-15 16:17:41 +00:00
David Baker
9f91995f4e
Fix tests by returning the original promise to avoid the extra trip around the event loop.
2016-03-15 14:15:15 +00:00
David Baker
85f2754300
Make the client object be an event emitter rather than a matrixclient to avoid us being tempted to gut wrench stuff directly into the Matrix Client.
2016-03-15 11:05:05 +00:00
David Baker
5833654aa6
Add Session.logged_out event that fires whenever the current session is no longer valid and the user needs to log in again. Also null check _syncApi before trying to stop it.
2016-03-15 10:45:08 +00:00
David Baker
bd600f65fb
Add support for new keypair style 3pid invites (add an option to joinRoom for specifying the signing url)
2016-02-23 10:11:04 +00:00
Matthew Hodgson
363b08c4d8
don't NPE on 50x's - as per BOTS-170
2016-02-22 10:34:43 +00:00
Daniel Wagner-Hall
02196416e4
Use /r0 or /unstable for all requests
2016-02-08 11:15:30 +00:00
Kegan Dougal
7bdab05785
Unbreak tests
2016-01-21 17:34:12 +00:00
Kegan Dougal
197144dcda
Implement a keep-alive timer for /sync requests
...
When a /sync request fails, we spin up a keep-alive poll to /_matrix/client/r0
which 400s. We treat any HTTP response code as a success for the purposes of
polling the server. When a successful poll is done, we shoot the current /sync
request in the head immediately (via a hacky abort() on the promise) and retry
the /sync.
2016-01-21 17:17:27 +00:00
Matthew Hodgson
446faed9b5
copyrights please...
2016-01-07 04:15:38 +00:00
Kegsay
b90697264c
Follow the spec
2015-12-15 15:33:56 +00:00
Kegan Dougal
bfda04daea
Move local timeout logic to the HTTP API class. Fixes /sync bug
...
The ability to set a local timeout is applicable to any request, so move it
to http-api.js - We only use this on /sync requests currently. This simplifies
the SyncApi since it doesn't need to worry about it anymore -- the request
promise just gets rejected if the timer expires.
Whilst testing I noticed a weird anomaly which I cannot explain. Playing with
Chrome's network debugger, once you recover from a black hole (0kbps, 90s RTT)
the subsequent requests take 20s to return *even though there is no throttling*.
This was causing issues when using a local timer of timeout= and BUFFER_PERIOD_MS
when timeout=1 due to attempts>1 - they were being knifed before the response
could return. The 20s latency was entirely artifical (checked synapse logs and
they were sub 1s), but I cannot find anywhere in the JS-SDK or browser-requests
where this would be the cause. This persisted even when BUFFER_PERIOD_MS was
changed from 20s to 10s.
2015-12-15 11:59:41 +00:00
Kegan Dougal
71d5756223
Fix linting
2015-12-04 09:36:18 +00:00
David Baker
7f5ad041cc
Pass the http status out with the error so upper level can can see what went wrong.
2015-12-03 10:51:09 +00:00
David Baker
92ea275275
Add ability to cancel file uploads
2015-12-02 18:14:13 +00:00
Steven Hammerton
b963f177cc
Update CAS login to return url rather than update location as the JS SDK may not be run within a browser env
2015-11-06 12:11:50 +00:00
Steven Hammerton
c3097979f2
Change login with CAS to redirect to HS for CAS login
2015-11-06 11:19:32 +00:00
Kegan Dougal
2c805bbece
More paranoia when handling responses
2015-10-21 16:00:31 +01:00
Kegan Dougal
f26154d0ac
Add support for m.room.avatar: refactor avatar URLs
...
BREAKING CHANGE.
Scope each "getAvatarUrl" to be instance methods on the entity it
relates to (Room and RoomMember respectively). By doing this, we
can actually pull out specific state such as the `m.room.avatar`
event more easily rather than keeping it in the global cesspit
of `MatrixClient`.
This was complicated by `getHttpUriForMxc` and `getIdenticonUri`
which were attached to the HTTP API to pull out the `baseUrl` when
crafting the URL. Pull out this dependency out and explicitly pass
it in when crafting the URL. This is trivial to get from
`MatrixClient.getHomeserverUrl()`.
2015-10-19 14:14:34 +01:00
David Baker
682880d0c9
Use a default content type if the browser doesn't give us one: home servers require a content type header.
2015-10-02 18:36:09 +01:00
Kegan Dougal
3c01e2db43
Style checks
2015-09-02 09:50:43 +01:00
Matthew Hodgson
3b9f1728c7
turn HTTP exceptions into errbacks or rejected deferreds rather than bubbling them up and expecting the app to have try blocks eeeeeeeeeverywhere
2015-08-31 18:26:27 +01:00
Kegan Dougal
c1c2731f2e
Set the Content-Type on uploads
...
Most browsers seem to set this if you forget, but some don't.
2015-08-14 15:09:31 +01:00
Kegan Dougal
54a5c38b66
Do not retry requests which 40[0/1/3]. Set 'errcode' on MatrixErrors
2015-07-29 10:30:07 +01:00
Kegan Dougal
9993e5dbed
Cleanup jsdoc. Allow extra query params to be set on requests (for ASes).
2015-07-28 10:57:05 +01:00
Kegsay
c3696d07b7
Merge pull request #14 from matrix-org/registration
...
Registration
2015-07-16 10:22:11 +01:00
David Baker
ff1b137750
add js doc for httpStatus
2015-07-16 10:18:51 +01:00
David Baker
77d3add846
Talk to the ID server
2015-07-14 19:36:44 +01:00
Kegan Dougal
8af5ed363b
Merge branch 'develop' into voip
2015-07-14 12:04:00 +01:00
David Baker
864fdcb925
Support V2 registration
2015-07-13 19:15:10 +01:00
Kegan Dougal
0ef20faff7
Add JSDoc; Add createNewMatrixCall to globals.
2015-07-13 17:11:37 +01:00
David Baker
9f930f7d0d
Redundant suffix is redundant.
2015-07-13 14:39:11 +01:00
David Baker
a6b0ea8825
Spaces around operators
2015-07-08 16:13:54 +01:00
David Baker
34086f48fa
Separate impl for node and extend example node app to use it.
2015-07-08 16:13:10 +01:00
David Baker
5e0d5a5b05
Fix some linitng errors
2015-07-08 15:01:38 +01:00
David Baker
639522f80d
Add uploadContent method
2015-07-08 14:33:46 +01:00
David Baker
f29f2a8115
Move getAvatarUrl into the client because it requires an instantiated client to work. Fix bits of client to use opts rather than credentials which doesn't exist.
2015-07-02 18:22:46 +01:00
Kegan Dougal
c73881f3fe
Use utils.keys rather than Object.keys for older browsers.
2015-06-08 12:22:23 +01:00
Kegan Dougal
6f4b600c0b
Appease closure linter.
2015-06-05 14:54:06 +01:00
Kegan Dougal
7ed92fd4f9
More jsdoc
2015-06-05 14:03:00 +01:00
Kegan Dougal
02064bac8a
Recombine initialSync/event high-level logic with HTTP API calls.
2015-06-05 13:30:11 +01:00
Kegan Dougal
300568ef70
Add ability for power users to access the response headers/status code if they desire.
2015-06-05 11:54:27 +01:00
Kegan Dougal
d095eff1a4
Bake in support for promises.
...
This means we can specify the SDK's dependency on Q to make setting things up
significantly easier.
2015-06-05 11:41:26 +01:00
Kegan Dougal
fce4d5d1d6
Add MatrixError class. More jsdoc voodoo to get things looking right.
2015-06-05 11:28:28 +01:00
Kegan Dougal
7ab3e25218
Add @module docs. Remove browser-build.sh
...
Add @links for HTML output. Replace browser-build.sh with inline commands
in package.json so building will work on non-unix machines. Update README.
2015-06-04 16:34:00 +01:00
Kegan Dougal
31ffdf8a37
Style checks and more jsdoc.
2015-06-04 16:02:08 +01:00
Kegan Dougal
a95f9d3717
Make MatrixHttpApi a generic API interface; move specifics to MatrixClient.
...
Add a utils file to store common operations like map() and encodeParams().
Modify MatrixClient and MatrixHttpApi to accepts opts as constructors.
2015-06-04 15:39:36 +01:00
Kegan Dougal
d1e51de7ec
Split out matrix.js into different files. Glue things back.
...
Added a models directory. Added store, http-api and client files. Slowly
transitioning to the architecture outlined in SYJS-5.
2015-06-03 17:55:12 +01:00