Open marshallswain opened 8 years ago
Notes from the meeting.
feathersClient - maintained independently
Making re-attachment work
Problems:
- it slow
- statefully authenticated.
cookie ->
socket.emit("authenticate", {token: cooke.read("token")})
- one socket for every incoming SSR request. We'd have to make a new one for each.
- share approach
- socket = io()
socket.emit() =>
var socket = io()
socket.emit()
- socket.io shim ... underneath socket.emit
- if it were a global ... we could
var XHR = XMLHTTPRequest;
getList : function(){
new XHR()
}
Benefit:
- anything works
var ssrConnection = connect(["data-url"],{
url: "/api/todos"
})
Todo.connection = connect(["can-connect-ssr","feathers-socket.io"],{
serverSideConnection: ssrConnection,
Map: Todo
});
behavior("can-connect-ssr",function(baseConnection){
getListData: function(){
if(!Zone.re-attached || isNode) {
return this.serverSideConnection.getListData.apply(this.serverSideConnection, arguments);
} else {
baseConnection.getListData({})
}
}
})
This won't be necessary if https://github.com/donejs/done-ssr/issues/198 happens.
XHR requests made by the SSR server get stored in the XHR_CACHE. The socket.io client isn't aware of it, so it makes the same requests again instead of using the cached ones.Based on the meeting notes in the next comment, we need to make a behavior specifically for SSR that...
feathers
behavior) on the client AFTER re-attachment.